Skip to content

Instantly share code, notes, and snippets.

@aurels
Last active December 28, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aurels/7564743 to your computer and use it in GitHub Desktop.
Save aurels/7564743 to your computer and use it in GitHub Desktop.
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);
});
}
}
});
<input type="text" ng-model="customer_tag.name" unique unique-own-id="{{customer_tag.id}}" />
@aurels
Copy link
Author

aurels commented Nov 20, 2013

En faisant ça, ng-model n'est plus évalué car son contexte a changé.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment