ng-include上的ng-repeat包含多次相同的页面

时间:2017-03-14 18:50:50

标签: angularjs

我在ng-repeat中有一个ng-include。所有ng-include都包含相同的html页面。当我在其中一个ng-repeat循环中更新html页面时,它会更新所有ng-includes。我想知道我是否可以包含相同的页面,但允许更改一个而不更改另一个

锻炼html

<div ng-repeat="workout in workoutList">
  {{workout["name"]}} - {{workout["description"]}}
 <button ng-click="showDiv = !showDiv; show(workout.id)"> + </button>
 <div ng-show="showDiv" ng-include="'workout/_show.html'"></div>
</div>

显示html

{{workoutShowList}}
<button>Add new Exercise</button>

显示控制器

    $scope.show = function(workout_id){
        WorkoutService.show($scope.id, workout_id).then(function(response){
            $scope.workoutShowList = response.data
        })
    }

0 个答案:

没有答案