javascript - Change value inside directive template and watch for changes -


inside directive template have ng-disabled need change when validationscope changed....

here directive:

var addcomment = {     link: link,     restrict: "e",     replace: true,     scope:{         validationscope:'@'     },     template: '<button type="submit" ng-disabled="validationscope" class="btn btn-default pull-right">send</button>' }; 

in html put this:

<mydirective validation-scope="<%maincomment.maintxt.$invalid%>"></mydirective> 

problem whith code ng-disabled allways true if maincomment.maintxt.$invalid% changed...

also if in directive template put this: {{validationscope}} can see value change to: true/false...

do might work now:

template:'<button type="submit" ng-disabled="{{validationscope}}" class="btn btn-default pull-right">send</button>' 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -