问题描述:

I am unable to print the value in HTML for below code in angular js, can any one help on this?

angularjs controller code :

$scope.arr=[new Map().set("MYKEY","MYVALUE")];

html code :

{{arr}}

Can any one tell how to display this using angular js tags in html.

网友答案:

You should use $scope.arr to access data from DOM.

Angularjs controller code :

$scope.arr = [new Map().set("MYKEY","MYVALUE")];

Html code:

{{arr}}

网友答案:

Its done by---> Amruth

Thank You Amruth...!!! It was really helpfull........!!!!

网友答案:

I have tried below code its working, please check it once.

Angularjs code:

$scope.DATA = [];
var arr =[new Map().set("MYKEY","MYVALUE")];
angular.forEach(arr, function (iterate) {
angular.forEach(iterate, function (value, key) {
$scope.DATA.push( { key : key, value : value } );
})
});

Html code: <ul> <li ng-repeat='(key, value) in DATA'> <span>Key: {{value.key}}</span> <span>value: {{value.value}}</span> </li> </ul>

相关阅读:
Top