Last active
December 28, 2015 21:29
-
-
Save aurels/7564743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mainApp.directive('unique', function($http) { | |
return { | |
restrict: 'A', | |
require: 'ngModel', | |
scope: { | |
ownId: '@uniqueOwnId' | |
}, | |
link: function(scope, elem, attr, ctrl) { | |
scope.$watch(attr.ngModel, function(value) { | |
console.log(value); | |
}); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" ng-model="customer_tag.name" unique unique-own-id="{{customer_tag.id}}" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
En faisant ça, ng-model n'est plus évalué car son contexte a changé.