How to set dynamic variable name in Angularjs controller
Use $scope[field] = value;
instead.
With $scope.field
, you're creating a new attribute named field
.
Use $scope[field] = value;
instead.
With $scope.field
, you're creating a new attribute named field
.