0
是否有任何方法在角2(v.2.4.0)使循環,或forEach循環從類的每個對象?我的意思是角度forEach所有對象來自類
export interface RegistrationDataInterface {
first_name: string;
surname: string;
used_name: string;
email: string;
}
export class Smth{
registrationSharingData: RegistrationDataInterface;
checkOut(){
forEach(item from this.registrationSharingData)
{
if(item!="null")
{//dosmth}
}}}
我不想讓20個IFS,謝謝:)
類型'RegistrationDataInterface'不是數組類型或字符串類型。 –
是不是一個數組? – Sajeetharan
不,很抱歉,我不清楚我需要從一個類中選擇所有項目(名字,姓氏等),而不是從類數組中+我編輯我的示例代碼 –