[英]Angular 7 Expected 2 arguments, but got 1 error
it says this,是这样说的
checkNonEnglishCharacterCountries(idArray[0].name);
checkNonEnglishCharacterCountries(idArray[0].name); An argument for 'textAccessHeader' was not provided
未提供“textAccessHeader”的参数
private checkNonEnglishCharacterCountries(countryName,textAccessHeader) {
if (countryName === 'Japan' && textAccessHeader == 'BANK_ADD') {
this.payment.bankAccountName = null;
this.payment.partyAccountNameAlt = this.supplierData.legalName;
this.selectedCountryValidator = '^([\uFF61-\uFF9F]|[()., _-])*$';
this.accountBeneficiaryName = 'Japanese half-width Katakana - 日本語の半角カタカナ';
this.branchNameLocal = 'Japanese half-width Katakana - 日本語の半角カタカナ';
this.bankNameLocal = 'Japanese half-width Katakana - 日本語の半角カタカナ';
}
}
You have two options.你有两个选择。
Either make the second parameter optional要么使第二个参数可选
private checkNonEnglishCharacterCountries(countryName: string, textAccessHeader?: string) {
...
}
Notice the question mark in the type definition of the parameter注意参数类型定义中的问号
or send in null
as the second paramter或发送
null
作为第二个参数
private checkNonEnglishCharacterCountries(countryName: string, textAccessHeader: string) {
...
}
Calling statement调用语句
this.checkNonEnglishCharacterCountries(idArray[0].name, null);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.