You can see in my fiddle that the value for each name is set to 0.
I'd like my changeAllValues() to change all the
value: 0's
to be
value: 1's!
What is the best way to do this?
JS Fiddle: https://jsfiddle.net/purple_lightsaber/edegcLnh/
PS:
ng-click="changeAllValues()
must be outside of my ng-repeat like it is in the fiddle.
Any help is appreciated :)
You can do this,
$scope.changeAllValues = function() {
angular.forEach($scope.names, function(item) {
item["value"] = 1;
})
}