html - ng-click access child controller function from parent controller -
its ng-repeat limiting or slicing , slice value changing on ng-click
html structure
it work if moving 'next, prev' buttons hometeamctrl html structure different, 'next, prev' buttons standing outside of hometeamctrl
<ul ng-controller="hometeamctrl 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>
question how can access ng-click (next, prev) parent controller
controller
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 ; } }]);
Comments
Post a Comment