angularjs-ng-init

ng-init in ng-repeat shows only the last item info

落花浮王杯 提交于 2019-11-28 01:43:25
I want to loop through items like this: <section class="col-sm-4" data-ng-controller="PredictionsController" data-ng-init="findMyPredictions()"> <div class="games"> <div class="game-row" ng-repeat="prediction in predictions" ng-init="getGame(prediction.game_id)"> <a class="button primary alt block" href="#!/predictions/{{prediction._id}}"> <span class="home flag {{gameInfo.team1_key}}"></span> <span class="middle"> <span class="date">{{gameInfo.play_at | date: 'd.MM HH:mm'}}</span> <span class="versus">{{gameInfo.team1_title}} - {{gameInfo.team2_title}}</span> </span> <span class="away flag {

Angular passing scope to ng-include

大憨熊 提交于 2019-11-27 19:37:35
I have a controller that I wrote that I use in multiple places in my app with ng-include and ng-repeat , like this: <div ng-repeat="item in items" ng-include="'item.html'" ng-controller="ItemController" ></div> In the controller/template, I expect the item value to exist, and the whole thing is built around this idea. Now, though, I need to use the controller in a slightly different way, without the ng-repeat , but still need to be able to pass in an item . I saw ng-init and thought it could do what I needed, like this: <div ng-init="item = leftItem" ng-include="'item.html'" ng-controller=

ng-init in ng-repeat shows only the last item info

守給你的承諾、 提交于 2019-11-26 21:58:22
问题 I want to loop through items like this: <section class="col-sm-4" data-ng-controller="PredictionsController" data-ng-init="findMyPredictions()"> <div class="games"> <div class="game-row" ng-repeat="prediction in predictions" ng-init="getGame(prediction.game_id)"> <a class="button primary alt block" href="#!/predictions/{{prediction._id}}"> <span class="home flag {{gameInfo.team1_key}}"></span> <span class="middle"> <span class="date">{{gameInfo.play_at | date: 'd.MM HH:mm'}}</span> <span