JSFiddle - React, Tailwind, and code Playground
by evoSL
HTML
<ul ng-controller="DaCtrl as d">
<li ng-repeat="item in d.itemlist">{{item.id}}</li>
</ul>
JavaScript
var app = angular.module('jobs', []);
app.controller('DaCtrl',function(){
this.itemlist = listObj;
});
var listObj = [{id:"001"},{id:"002"},{id:"003"}];
function addItems(){
listObj = [];
dataObj = ajax();
//I need to remove all the existing elements and add new set of items to the array just like this.
listObj = dataObj;
}
function ajax(){
//Data will come from ajax request
return [{id:"005"},{id:"006"},{id:"007"}];
}