There is fiddle
var app = angular.module( 'myApp', [] );.....
I need to find out the number of list item , which is under editing or bluring to manipulate by it as I need.
How to do it ?
What about replacing this part of your jsFiddle :
<li ng-repeat="contact in contacts">
{{contact.name}}
</li>
with this:
<li ng-repeat="contact in contacts">
<edit-in-place value="contact.name"></edit-in-place>
</li>
That way you don't have to know the index of item as edit-in-place
directive will take place after ng-repeat
kicks in.
Priority of ng-repeat
directive is 1000 and default directive priority (if you don't specify it) is 0.
More abourt directive's priorities from AngulaJS docs :
When there are multiple directives defined on a single DOM element, sometimes it is necessary to specify the order in which the directives are applied. The priority is used to sort the directives before their compile functions get called. Priority is defined as a number. Directives with greater numerical priority are compiled first. Pre-link functions are also run in priority order, but post-link functions are run in reverse order. The order of directives with the same priority is undefined. The default priority is 0.
There is working jsFiddle .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.