Coder Social home page Coder Social logo

cvn / angular-shims-placeholder Goto Github PK

View Code? Open in Web Editor NEW
62.0 62.0 26.0 378 KB

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.

License: MIT License

JavaScript 21.31% HTML 78.69%

angular-shims-placeholder's People

Contributors

akkunchoi avatar burgov avatar cvn avatar danielcrisp avatar jrief avatar o-mutt avatar rudasn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-shims-placeholder's Issues

Can't install

npm ERR! Darwin 14.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "angular-shims-placeholder" "--save"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] postinstall: `bower install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'bower install'.
npm ERR! This is most likely a problem with the angular-shims-placeholder package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     bower install
npm ERR! You can get their info via:
npm ERR!     npm owner ls angular-shims-placeholder
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/kaelan/work/apps/hn-enterprise-portal/npm-debug.log

Tabbing to Password field does not work

Since the text field you are creating in order to show the placeholder for password type fields does not have a tabIndex, it falls to the bottom of the tabbing order. To get it to work in my app, I changed the function to get the tabIndex of the password input and set the tabIndex of the new text input to the same value:
function setupPasswordPlaceholder() {
var tabIndex = domElem.tabIndex;
clone = angular.element('');
...

Angular version

Hi, can this be updated to support angular 1.3+ ? right now the bower file says that only supports 1.2~.

DI support

Hi,

Can you please update the code to be DI compatible?
You need to prefix the directive definition like so
.directive('placeholder',['$timeout', '$document', '$interpolate', '$injector', 'placeholderSniffer', function($timeout, $document, $interpolate, $injector, placeholderSniffer) {

don't foget to add the ] at the end of the function :)

Update bower to support angular 1.6.

This may be a little preemptive, but I was getting a head start updating our app to the 1.6 release candidate and I haven't had any issues yet with this library supporting it.

Is there a chance we can get the bower file updated to support this?

hiding model when password field change

hi
thanks for the code, it is very helpful.

i think i found a minor fix -

if the ng-model of a password is changed, the place holder is not hidden. so if i load a form with saved password, the place holder is hiding the password field, and it looks like you need to put the password

Add to bower registry

Now that the project has a bower.json file, it can be submitted to the bower registry.

The first thing that needs to happen is releases need to be tagged. I suggest creating a v0.1.0 tag at f05c0d8 (for historical purposes) and a v0.2.0 tag at the most recent commit. You can tag old commits on the releases page in the Target dropdown menu > Recent Commits tab. https://help.github.com/articles/creating-releases

Once that is done, you can add it to the bower registry from the command line bower register angular-shims-placeholder git://github.com/jrief/angular-shims-placeholder.git If bower is not installed globally, you may have to run it with ./node_modules/bower/bin/bower http://bower.io/#registering-packages

Add protractor E2E tests

It would be valuable that being a library written for angular, unit tests would be rewritten using protractor.

In addition by means of grunt-protractor-runner it would be valuable to interconnect unit tests to saucelabs in order to automatize browser testing; saucelabs infact offer free accounts for opensource projects like angular-shims-placeholder

I'm writing this while integrating the library in GlobaLeaks globaleaks/GlobaLeaks#1533, that has a complete unit testing in place like the one i'm describing and where the library appear to not work properly.

From what i'm testing manually it works great but it seems to cause protractor detecting angularjs startup and this may lie some bugs: https://api.travis-ci.org/jobs/97890200/log.txt?deansi=true

Does this actually support IE7?

You state this in the readme:

such as IE9, IE8, and below

But it seems it doesn't actually work in IE7. Can you confirm?

I also tried the demo page but it errors because it uses console so I can't tell if it should be working

ngModel -> ?ngModel

ngModel should be optional. My application is not fully SPA and that is why my input elements may not have ngModel defined. Now if you don't define ngModel it will break. :<

Update bower angular version to 1.5

Angular 1.5 was just recently released. I haven't noticed any issues in IE9 and above (including running the tests).

Would it possible get bower.json updated for angular 1.5?

Thanks!

No whitespace between some words

Hello!

On the latest IE9 (v9.0.40) some inputs has no whitespace between words.
No whitespace
Some lost whitespaces are showed by red points.

Thank you.


I will try to debug this situation later, but, maybe, you have a fast solution for this.

Compile template with ng-model cannot show the initial ng-model value

Compile a template and append to element, within the template there is an input with both ng-model and placeholder.
It can only show placeholder text, but not the ng-model value.
Instead, i think it should show the ng-model value(when ng-model value is not empty). And when user empty the input afterwards, the placeholder text shows again.

My fix:

With a change from

var orig_val = elem.val() || ''
to
var orig_val = eval('scope.'+elem[0]['ng-model']) || elem.val() || ''

can fix this, but i know it's really ugly and evil to use eval.
i also tried ngModel.$modelValue but always return NaN. Change priority of module is useless.

sorry be a newbie to angular

Issue with the ng-model directive

Hi, thanks for this module.

When I have an input with ng-model bound to a defined value, the placeholder replace that value. It is not a wanted behavior. It happen in IE8.

Update placeholder after change

Hi,

thanks for your directive. :)

I'm changing the placeholder of an input text in my code in this way: $('#inputWithPlaceholder').attr('placeholder', 'new placeholder text');

Unfortunately the new placeholder is not shown in IE. I thought I could force the change by doing something like this:
$('#inputWithPlaceholder').triggerHandler('change');

Am I on the wrong track? Do you have an idea how to solve this problem?

Thanks!

Cheers,
Stefan

ie9: Placeholder displayed instead ng-model value when ng-model value set later in same digest cycle.

If the ng-model value is initialized after the placeholder directive (but in the same digest cycle), the value is hidden, and the placeholder is displayed instead.

see https://jsfiddle.net/7arxneod/6/ If you watch closely, the value will flicker between the expected value ($1.00) and 'placeholder' in ie9.

The issue seems to be the initialization of the placeholder. Since the placeholder directive's link function executes first, updateValue() will update the elements value in the next digest cycle to an empty string.

When the other directives link function initializes the value, the $render() function will correctly set the element's value, but because updateValue() uses $timeout, the displayed value is overridden in the next digest cycle.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.