从父控制器

时间:2016-01-27 11:07:04

标签: html angularjs scope angularjs-ng-click

在ng-click上更改ng重复限制或切片和切片值

html结构

如果我将'next,prev'按钮移动到homeTeamCtrl但是我的html结构有所不同,它会工作,'next,prev'按钮站在homeTeamCtrl之外

   <ul ng-controller="homeTeamCtrl as homeTeam"> 
       <li ng-repeat="team in homeTeam.teamMembers.slice(homeTeam.start, homeTeam.end)">
       </li>
    </ul>

    <div class="prev" ng-click="homeTeam.prev(homeTeam.start, homeTeam.end)">prev</div>
    <div class="next" ng-click="homeTeam.next(homeTeam.start, homeTeam.end)">next</div>

</div>

问题那么如何从父控制器访问ng-click(next,prev)

控制器

app.controller('homeTeamCtrl', ['designAppFactory', function(designAppFactory){
    vm.start = 0;
    vm.end = 4;
    vm.next = function(start, end){
            vm.start = start + 4;
            vm.end = end + 4 ;
    }
}]);

0 个答案:

没有答案