2017-06-22 38 views

回答

0

在formly形式的模型值只需添加您的數據作爲下一個項目。 基於例如,如果我們將有這樣的模型

vm.model = { 
    investments: [ 
     { 
     investmentName:'abc', 
     investmentDate:(new Date()).toDateString(), 
     stockIdentifier:'', 
     investmentValue:'', 
     relationshipName:'', 
     complianceApprover:'', 
     requestorComment:'' 
     }, 
     { 
     investmentName:'haf', 
     investmentDate:(new Date()).toDateString(), 
     stockIdentifier:'', 
     investmentValue:'', 
     relationshipName:'', 
     complianceApprover:'', 
     requestorComment:'' 
     } 
    ] 
    }; 

那麼當你將recive你的數據(我假設你正在使用的承諾),在隨後的承諾附加的部分recived數據vm.model.investments陣列 例如

someService.getMyData().then(function (data) { 
    vm.model.investments.push(data); 
}