#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
|
There was a problem hiding this comment.
What's the difference between ctrl.$viewValue and scope.$eval(attrs.ngModel) in our model.
There was a problem hiding this comment.
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" notifications@github.com 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.
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.