Angular выдает ошибку для моего кода, когда я пытаюсь вложить массив. Кто-нибудь может мне помочь? Мой код выглядит так:
parents = {
pfirst_name: '',
pmiddle_name: '',
plast_name: '',
...
}
students = {
sfirst_name: '',
smiddle_name: '',
slast_name: '',
...
}
both = {
this.parents,
this.students
}
И я получаю эту ошибку:
ERROR in ./src/app/app.component.ts
Module parse failed: Unexpected token (61:18)
You may need an appropriate loader to handle this file type.
| };
| this.both = {
| this: .parents,
| this: .students
| };
Я тоже пробовал по-другому:
both = {
parents = {
pfirst_name: '',
pmiddle_name: '',
plast_name: '',
...
},
students = {
sfirst_name: '',
smiddle_name: '',
slast_name: '',
...
}
}
Я получаю эту ошибку:
ERROR in src/app/app.component.ts(18,9): error TS2552: Cannot find name 'parents'. Did you mean 'parent'?
src/app/app.component.ts(18,17): error TS1312: '=' can only be used in an object literal property inside a destructuring assignment.
src/app/app.component.ts(28,9): error TS2304: Cannot find name 'students'.
Любая помощь очень ценится!