Next question: why are you using the square bracket notation? Why not: myObj.mykey? Also.... Are you sure you've initialized myObj?
On Sun, Jul 17, 2016, 15:10 p. stephen w <[email protected]> wrote: > Its defined on the component. > > works as expected. > <div *ngIf="myOb">woot</div> > > > On Sunday, July 17, 2016 at 11:48:21 AM UTC-7, Lucas Lacroix wrote: > >> Where is "myObj" defined? >> >> On Sun, Jul 17, 2016, 14:17 p. stephen w <[email protected]> wrote: >> > This line produces an error on 'myObj': >>> Cannot read property 'mykey' of undefined. >>> <div *ngIf="myObj['mykey']">woot</div> >>> >>> It sounds like NG2 will not iterate over objects, and the only way >>> around it is to write a custom pipe, or put a function on the component to >>> parse the object. >>> Do I have the current and correct understanding on this? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "AngularJS" group. >>> >> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected]. >>> To post to this group, send email to [email protected]. >> >> >>> Visit this group at https://groups.google.com/group/angular. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
