将多个值推入数组会导致使用angular6时出错
我在angular 6中工作,这里我想将多个值推入数组,这给了我以下错误 这是我的密码将多个值推入数组会导致使用angular6时出错,angular6,Angular6,我在angular 6中工作,这里我想将多个值推入数组,这给了我以下错误 这是我的密码 this._model.NomineeList.push( { 'FirstName': this._nomineemodel.FirstName, 'CNIC': this._nomineemodel.CNIC, 'MiddleName': this._nomineemodel.MiddleName,
this._model.NomineeList.push(
{
'FirstName': this._nomineemodel.FirstName,
'CNIC': this._nomineemodel.CNIC,
'MiddleName': this._nomineemodel.MiddleName,
'LandlineNumber': this._nomineemodel.LandlineNumber,
'LastName': this._nomineemodel.LastName,
'MobileNumber': this._nomineemodel.MobileNumber,
'PermanentAddress': this._nomineemodel.PermanentAddress,
'PresentAddress': this._nomineemodel.PresentAddress,
'RelationId': this._nomineemodel.RelationId,
'RelationName': this._nomineemodel.RelationName,
'UPermanentAddress': '',
'UPresentAddress': ''
});
如何使用angular 6推入阵列。错误是不言自明的,插入阵列的型号不同,它们不相同。有两个可能的原因 1) 要么您没有使用空值启动数组。或 2) 您插入的模型缺少必需属性,或者新模型没有多少额外属性,或者名称拼写错误
检查此示例。我已经启动了数组,还有这个。\u提名列表和这个.提名模型都是我正在使用的类。我不知道为什么会出现错误,请在stackbliz上提供最小的可复制代码,以便进一步了解您的问题。