-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#113 removing directive scope dependency #162
Conversation
cool @Nazanin1369 Does it really fix the problem 113 ? or you can tell us more about this fix. It's looks perfect to isolate the scope. |
This commit removes the isolated scope from the directive so we can have
|
@@ -288,7 +289,7 @@ | |||
*/ | |||
if (attrs.validMethod === 'blur') { | |||
element.bind('blur', function() { | |||
var value = ctrl.$viewValue; | |||
var value = scope.$eval(attrs.ngModel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between ctrl.$viewValue
and scope.$eval(attrs.ngModel)
in our model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the same but since we have ng-model defined as our directive attr I
think it is better to use that rather than controller view value. Then what
would be the usage of ngModel?
On Nov 29, 2015 9:51 PM, "Huei Tan" [email protected] wrote:
In src/validator.directive.js
#162 (comment)
:@@ -288,7 +289,7 @@
*/
if (attrs.validMethod === 'blur') {
element.bind('blur', function() {
var value = ctrl.$viewValue;
var value = scope.$eval(attrs.ngModel);
What's the difference between ctrl.$viewValue and
scope.$eval(attrs.ngModel) in our model.—
Reply to this email directly or view it on GitHub
https://github.com/huei90/angular-validation/pull/162/files#r46110404.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, but not sure if it exists any minor bug. (test cases look fine)
Looks good 👍 Thanks @Nazanin1369 I will merge after you commit the example. |
Better if we can add test case for this isolate. |
Sure. This is an initial commit. Will put up example and test case up
|
@Nazanin1369 Can't wait to see your update 😄 |
I just put up a final commit. I have actually removed the child scope and added a Bootstrap datepicker demo to the index.html page. The ui-bootstrap datepicker is working fine with our validator directive now. |
What is the main.html page? |
[Fix #113] removing directive scope dependency
It seems @Nazanin1369 use the messageId to prevent confusion between datepicker element and validate element in the demo page. Finally i configed getMsgElement like this, to solve it. $validation.getMsgElement = function (element) {
return element.nextAll('.validation-tip');
}; So, do you think you should consider adding some instructions about third party plug-in and the messageId, or just change the default getMsgElement Function? |
Hi all,
Here is an initial commit removing the isolated scope from validator directive.