1
上午檢索數據和我想的數列添加到數據Angular2添加項的數組中打字稿從數據庫
users:any[];
onGetUsers() {
this._userService.getUsers()
.subscribe(
res => {
this.users = res
for(var i=0; i<res.length; i++) {
//append the value of i to each row of the users
}
this.initialloading = false;
}
);
}
我想的i
值追加到用戶的每一行陣列。
所以最終的數據可以
currently when i console.log(users) am getting
users:
firstname:name1, second:name2 ....
firstname: john, second:king ...
現在我想補充另一列叫,使我有
users:
no:0, firstname:name1, second:name2 ....
no:1, firstname: john, second:king ...
如何做沒有在返回的用戶數組循環我去這個