0
我想更改組件中currentUrl對象的id屬性。我想實現的是一旦id被更改,它應該從id中獲取適當的數據。我目前正在得到下面的錯誤。如何更改角2中的currentUrl ID?
「無法指定讀取對象的唯一屬性'身份證‘的翻譯:’」
任何人可以幫助我解決這個問題?
addBranch(id){
this.currentUrl = this.activatedRoute.snapshot.params;
console.log(this.currentUrl.id); // Currently the id is undefined
this.currentUrl.id = id; //Cannot assign to read only property 'id' of object '[object Object]'
window.location.reload();
}
感謝哥們!有效!! –