angularjs - Adding data to a list in angular js -
am receiving data in form of {room1: 4, room2: 2}
received in name of roomdata
$scope.testdata = [{ 'room': 'room0', 'users': '10' }]; $scope.setlobbyroom = function (roomdata) { $scope.inc = 0; (i in roomdata) { //want push data array list here. } }
if want push data $scope.testdata, have use method push
$scope.testdata = [{ 'room': 'room0', 'users': '10' }]; $scope.setlobbyroom = function (roomdata) { $scope.inc = 0; (i in roomdata) { $scope.testdata.push(roomdata[i]); } }
Comments
Post a Comment