My approach to processing json data looks like this:
$scope.activities = response.data;
console.log($scope.activities.length);
var list = [];
for (var i = 0; i < $scope.activities.length; i++) {
console.log($scope.activities[i].name);
list.push($scope.activities[i].name);
}
var input = document.getElementById("myinput");
new Awesomplete(input, {
list: list
});
Alternatively, consider the following scenario:
<li ng-repeat="navItem in navItems" ng-click="itemClicked(item, $index)" ng-class="{'nav_list_item-current' : navItem.selected} " class="nav_list_item pure-u-md-1-{{navItemsCount}} pure-u-1-1">
<a class="nav_list_item_link" href="{{navItem.link}}">
{{navItem.name}}
</a>
</li>
Here, navItems represents a JSON object.
Although it works, how can I improve this implementation in Angular?