How to properly execute a function inside ng-repeat

后端 未结 4 1065
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 18:29

SITUATION:

I am making an app in AngularJs that assign permissions. In order to do this i have three nested ng-repeat.

First loop:

4条回答
  •  被撕碎了的回忆
    2021-01-01 18:58

    The subcategory example did not work for my case and it took my code into an infinte loop for some reason. may be because i was using an accordion.

    I achieved this function call inside ng-repeat by using ng-init

    
          {{s.name}}
          
    {{p.name}}

    The code on the controller side should look like below

    $scope.getPresenters = function(id) {
        return SessionPresenters.get({id: id});
    };
    

    While the API factory is as follows:

    angular.module('tryme3App').factory('SessionPresenters', function ($resource, DateUtils) {
    
            return $resource('api/session.Presenters/:id', {}, {
                'query': { method: 'GET', isArray: true},
                'get': {
                    method: 'GET', isArray: true
                },
                'update': { method:'PUT' }
            });
        });
    

提交回复
热议问题