Is it not possible in angular templates to repeat an array in DOM without using any html tags.
//like
<!-- required output -->
<div class="names">
name1 name2 name3 name4
</div>
//expected syntax
<ng-repeat item in items>
{{item.name}}
</ng-repeat>
i didnt use ng-repeat
instead i used foreach
here is the working code
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.items = ["simon", "joy","dona", "divya"];
$scope.names = function (argument) {
var allNames = "";
angular.forEach($scope.items, function(item) {
allNames = allNames + item + " ";
});
return allNames;
};
});
<body ng-controller="MainCtrl">
<div>{{names()}}</div>
</body>