Is the ng-repeat of AngularJS 1.x compatible with ES6 Maps?
The easiest way is to create your own angular filter as @Minato suggested.
You can use ES6 Spread syntax to convert map into array:
angular.module('SomeModuleName')
.filter('mapToArray', function() {
return function(map) {
return [...map.values()];
};
});
And then just use it in the template:
<div ng-repeat="item in Map | mapToArray">
You can also use lodash toArray method: https://lodash.com/docs/4.17.4#toArray
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With