Reputation: 2657
I'm pushing values to an array that came from a select box to accomplish that, I'm doing this:
$scope.selectedValues = [{
}]
$scope.print = function() {
$scope.selectedValues.push($scope.model);
}
<div>{{selectedValues}}</div>
What I see in my front end is the array whit the values [{},"01","02"]
and not the values only.
I need to present only the values.
Upvotes: 0
Views: 315
Reputation: 9190
Javascript
$scope.selectedValues = [];
$scope.print = function() {
$scope.selectedValues.push($scope.model);
};
Markup
<div>
<span ng-repeat="value in selectedValues">{{value}}</span>
</div>
Upvotes: 4
Reputation: 519
Problem is that you have pushing empty object into selectedValues {}. array should be declared like this
$scope.selectedValues = [];
Upvotes: 1