Angular Directive Does Not Evaluate Inside ng-repeat

后端 未结 6 1735
予麋鹿
予麋鹿 2020-12-30 08:38

I have the following setup:

App/Directive

var app = angular.module(\"MyApp\", []);

app.directive(\"adminRosterItem\", function () {
    return {
            


        
6条回答
  •  余生分开走
    2020-12-30 09:45

    Instead of writing your directive as a child of ng-repeat, try keeping the custom directive on the same level as ng-repeat, this

    
    

    And furthermore, allow your custom directive to be used as an attribute. AngulaJS has defined ng-repeats priority as 1000, so at times when you custom directive is made, it does not go down well with ng-repeat.

    A second option (try only if the first one fails) is to set the priority of your custom directive more than that of ngRepeat i.e. to 1001.

提交回复
热议问题