I am bad at explaining i hope you guys understand my requirements and help me out here.
I have a view with ng-repeat below
<div ng-repeat="item in allitems"> {{displaydata}} </div>
i have a controller with below data
$scope.allitems ={
1:{name:"car",price:"999",qty:8},
2:{name:"bag",price:"127",qty:2},
3:{name:"dog",price:"777",qty:3},
4:{name:"cat",price:"333",qty:4}
}
var displaychoice1 = "{{item.name}}"
var displaychoice2 = "{{item.price}}"
$scope.displaydata = "I want " + displaychoice1 + " which cost " + displaychoice2 ;
I want users to be able to select the "fields" to output to the view instead of hardcoding what to display in the view.
<div ng-repeat="item in allitems">I want {{item.name}} which cost {{item.name}}</div>
Or what exactly do you need?ng-repeat
wouldn't even work as written; this pattern is invalid for objects.allitems
would have to be an array.