0
votes

I am using Angular 6 and Angular Angular Material, I have dynamic list of polls with list of options. I want to show selected option with two way data binding. as my list is dynamic i want to pass variable in [(ngModel)]. tried passing variable but no luck please suggest alternate solution error Cannot read property '0' of undefined

stackblitz example code to reproduce issue

Same code works when data loaded from local array local data stackblitz

1
Where is myselection?yurzui
I am not able to access the link.Punith Mithra
Try accessing again i have just made editsRahul Talar
Hi yurzui i want myselection to be dynamic valueRahul Talar
stackblitz.com/edit/… working example when data is local but issue which json data thanksRahul Talar

1 Answers

1
votes

Your template does not match your component. If you check the error using Firefox Dev Tools, you'll see: "_co.myselection is undefined". myselection is not defined anywhere in your component.