Friday 15 January 2010

angularjs - how to pass bound value to custom directive -



angularjs - how to pass bound value to custom directive -

i want create directive this

<input ng-model="service" check-service="{{items}}" />

so every time value modified in input, want latest value of whatever object bound within check-service i.e. latest value of items. have basic directive not sure how can latest value

.directive('checkservice', ['$http', function($http) { homecoming { require: 'ngmodel', link: function(scope, ele, attrs, c) { scope.$watch(attrs.ngmodel, function(newval) { // how latest value of {{items}} here? } } });

you can utilize $observe property one.for please checked example. improve idea. demo link: http://jsfiddle.net/shivali/86upsdr0/

hope might helpful you!!

angularjs

No comments:

Post a Comment