Comments (6)
Hi!
Thanks for using the module. Yeah you are correct the html is not being recompiled so the directive is not initializing. You will need to do something like this:
makeInvalid = function (el, errorMsg) {
el.addClass('redtext')
el.attr("tooltip", "Tooltip here!");
$compile(el.contents())(el.scope());
}
You might need to check the scope and make sure the element is not using an isolatedScope.
You could also have a look at http://stackoverflow.com/a/21487754/1162133
Jon
from angular-auto-validate.
Hi Jon
Still not working, I guess I must have missed out something. I tried to look into el.scope()
, I wonder if it is returning the same scope back to the directive.
Here is a <a href=http://plnkr.co/edit/Wzn5GK7XG99PRFlAjUIJ?p=preview">plunkr that illustrates the situation. As you can see, in both input fields their validation requirements are the same. And yes their text do turn red on invalid state, but the tooltip was appended but not $apply()ed. :(
Anyway, this module is definitely awesome. :D
from angular-auto-validate.
Thanks! I'll take a look tonight :-)
from angular-auto-validate.
This works for me but the model is removed for some reason? I'll have a better look later.
makeInvalid = function(el, errorMsg) {
el.addClass('redtext');
el.attr("tooltip", "This is tooltip!");
var scope = el.scope();
$compile(el)(scope);
}
from angular-auto-validate.
The model is removed because every time the input is invalid, it will invoke our makeInvalid
function, and hence it will force a $compile
, thus flushing(refreshing) the ng-model
away. Lol. Very tricky. I will try to solve this or find any workaround.
If it is resolved I would love to have a PR and make some contribution or so.
from angular-auto-validate.
Try this....
makeInvalid = function(el, errorMsg) {
var val = el.val(),
scope = el.scope();
el.addClass('redtext');
el.attr("tooltip", "This is tooltip!");
$compile(el)(scope);
$timeout(function () {
el.val(val);
});
}
A pull request would be awesome! :-)
Jon
from angular-auto-validate.
Related Issues (20)
- package.json has incorrect main attribute HOT 3
- angular-auto-validate with bower
- Is there any way to display more than one error message?
- Validation not working with material md-select
- After submit data remoove styling HOT 1
- Update npm registry HOT 3
- conflict with sb-admin admin template HOT 2
- Failed when using an angular expression in ng-pattern
- min and max error description wrong i18n es-co
- Prevent validating ng-hide elements
- Value {0} replace dont work when use myCustomErrorMessageResolver HOT 1
- Passing a parameter from a Custom Validator directive to errorMessages doesn't work unless you make errorMessages dash-case. HOT 1
- cannot validate ng-form or sections in a form
- Show server side errors using this package
- Validate when state redirection
- custom error message (help)
- auto validate for other plugins
- autovalidate intefering with ngRequired directive
- request/potential bug: allow validation when on $touched instead of on $dirty HOT 1
- Can we use this for Angular5 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-auto-validate.