error console:
Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: m in diff, Duplicate key: object:131, Duplicate value: {"title":"Diamond Push Up","vid":"img/3mm.mp4","time":60,"cal":3,"reps":20}
Any workarounds for the above error?
$scope.moves = [
{title:"Jumping Jacks", length:"30", difficulty: "5 stars"},
{title:"Push Ups", length:"40", difficulty: "4 stars"},
{title:"Mountain Climbers", length:"60", difficulty: "2 stars"}
];
This works
$scope.workoutone =[
$scope.moves[0],
$scope.moves[1],
$scope.moves[2],
];
This does not work, only obvious difference is I am repeating the information
$scope.workouttwo =[
$scope.moves[2],
$scope.moves[1],
$scope.moves[2],
$scope.moves[0],
$scope.moves[1],
$scope.moves[2],
];
Is there any work around for using the same information from array multiple times in a new array? Thanks in advance for the help
EDIT (the HTML displayed to the user): Apologies for being vague! So the user will see workoutone initially but can choose, by clicking a button, to view other workouts such as workouttwo. Workoutone shows up fine (code is below) but as soon as the user clicks workouttwo, the information does not refresh. And then when the user clicks start workout, which just goes through each move in the workout, it outputs "NaN".
This is the code to show the workouts
<ion-list>
<ion-item ng-repeat="m in workoutchoice" class="eachitem">
<div class="animateded slideInUp" style="width:90%;max-width:450px;height:45px;margin-left:auto;margin-right:auto;background-color:white;border:0px solid black;color:red;border-radius:7px;">
<div style="height:100%;float:left;border:0px solid blue;">
<img src="img/1-2.jpg" style="height:100%;align:center;border-radius:7px;">
</div>
<div style="width:40%;height:100%;float:left;border:2px solid blue;margin-top:8px;margin-left:5px;font-size:12px;">
{{m.title}}
</div>
<div style="width:25%;height:100%;float:right;border:2px solid red;text-align:right;margin-right:10px;color:black;margin-top:8px;font-size:12px;">
{{m.reps}}x
</div>
</div>
</ion-item>
</ion-list>
And this is the code for the button that allows different choices of workouts
<div style="width:100%;height:50px;background-color:white;border:2px solid transparent;">
<div style="width:330px;border:2px solid transparent;margin-left:auto;margin-right:auto;margin-top:-10px;">
<img src="{{bub[3]}}" style="height:25px;margin-top:15px;float:left" ng-click="choosen(workoutone);">
<img src="{{bub[4]}}" style="height:25px;margin-top:15px;margin-left:31px;" ng-click="choosen(workouttwo);">
</div>
</div>
Another EDIT (js function called)
$scope.bubble = function(selectedCal) {
$rootScope.bub = selectedCal;
console.log(selectedBook);
}
$scope.choosen = function(selectedChoose) {
$rootScope.workoutchoice = selectedChoose;
console.log(selectedChoose);
$ionicScrollDelegate.resize();
}