Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Input() data: CivilLiabilityQuestionnaireModel;
- public questions: CivilLiabilityQuestionnaireModel;
- this.questions = { ...this.data };
- const questionGroupIndex = 0;
- const questionGroupItemIndex = 0;
- this.questions
- .questionGroup[questionGroupIndex]
- .questionGroupItems[questionGroupItemIndex]
- .answers[0]
- .value = form[val];
- // This works
- this.questions.id = 'hotdog';
- // This doesn't work
- // ERROR TypeError: Cannot assign to read only property 'id' of object '[object Object]'
- this.questions.questionGroup[questionGroupIndex].id = 'hamburger';
- this.questions = {
- ...this.questions,
- questionGroup: {
- ...this.questions.questionGroup,
- [questionGroupIndex]: {
- ...this.questions.questionGroup[questionGroupIndex],
- questionGroupItems: {
- ...this.questions.questionGroup[questionGroupIndex].questionGroupItems,
- [questionGroupItemIndex]: {
- ...this.questions.questionGroup[questionGroupIndex].questionGroupItems[questionGroupItemIndex],
- answers: {
- ...this.questions.questionGroup[questionGroupIndex].questionGroupItems[questionGroupItemIndex].answers,
- [0]: {
- ...this.questions.questionGroup[questionGroupIndex].questionGroupItems[questionGroupItemIndex].answers[0],
- value: form[val]
- }
- }
- }
- }
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement