angular-shims-placeholder

WebJar for angular-shims-placeholder

License

License

MIT
Categories

Categories

Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

angular-shims-placeholder
Last Version

Last Version

0.4.8
Release Date

Release Date

Type

Type

jar
Description

Description

angular-shims-placeholder
WebJar for angular-shims-placeholder
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/cvn/angular-shims-placeholder

Download angular-shims-placeholder

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/angular-shims-placeholder/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>angular-shims-placeholder</artifactId>
    <version>0.4.8</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/angular-shims-placeholder/
implementation 'org.webjars.npm:angular-shims-placeholder:0.4.8'
// https://jarcasting.com/artifacts/org.webjars.npm/angular-shims-placeholder/
implementation ("org.webjars.npm:angular-shims-placeholder:0.4.8")
'org.webjars.npm:angular-shims-placeholder:jar:0.4.8'
<dependency org="org.webjars.npm" name="angular-shims-placeholder" rev="0.4.8">
  <artifact name="angular-shims-placeholder" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='angular-shims-placeholder', version='0.4.8')
)
libraryDependencies += "org.webjars.npm" % "angular-shims-placeholder" % "0.4.8"
[org.webjars.npm/angular-shims-placeholder "0.4.8"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

angular-shims-placeholder

Bower version npm version Build Status devDependency Status

Angular directive to emulate the placeholder attribute on text and password input fields for old browsers, such as IE9, IE8, and IE7. Also works on textareas and html5 input types.

This directive works in both directions, which means that changing the value from inside the model is honoured in the form.

In comparison to https://github.com/urish/angular-placeholder-shim, this Angular directive is implementend purely on the AngularJS API and does not depend on other libraries, such as jQuery and jquery-html5-placeholder-shim.

Demo

View Demo

Usage

Include

<script src="angular-shims-placeholder.min.js"></script>

into your application.

Add the module as a dependency to your application module:

angular.module('MyAwesomeApp', [/* other dependencies */, 'ng.shims.placeholder']);

That's it. Now, text fields having an attribute placeholder behave almost as native placeholder fields, even on IE8 and below.

Example:

<input type="text" name="email" placeholder="Enter your email" />

Notes

The class empty is added when the input is empty and the placeholder is showing. Make it look like a placeholder e.g. .empty { color: #a9a9a9; }

If you modify a shimmed input from outside of Angular, trigger the 'change' event to update the placeholder display e.g. elem.triggerHandler('change')

Compatibility

  • Angular 1.0.8 - 1.x
  • IE9, IE8, IE7 * (see known issues)
  • ngModel, ngDisabled, ngReadonly, ngRequired, ngShow, ngHide, ngAttrPlaceholder
  • ngAnimate (Angular 1.3+ only)

Known Issues

  • Angular 1.3 dropped support for IE8, and 1.2 dropped IE7. If you need to support those browsers, use an older version of Angular.
  • Ignores text input from drag and drop
  • Does not support modern-style placeholders that persist until text is entered
  • IE8/9: Disabled textareas show the text insertion cursor on hover. This is due to an IE bug.
  • IE8/9: Clearing a filled input while its text is selected can cause the resulting placeholder text to appear selected
  • No way for an individual input to opt out
  • Not tested with ngSubmit
  • Not tested with ngClass
  • ngAnimate: Password placeholder text pops in after animations complete
  • The unit tests only work with Angular 1.2 and up

Development

  • First, run npm install and bower install to get the required dependencies
  • the source files are in the lib folder
  • grunt build to build the dist files
  • grunt dev to show the demo page and watch for changes
  • grunt test to run unit tests

Authors

Original author: Jacob Rief
Maintained by: Chad von Nau

License

Released under the terms of MIT License.

Versions

Version
0.4.8