[Angular] Cannot read property 'name' of undefined

6 görüntüleme
İlk okunmamış mesaja atla

jamester go

okunmadı,
22 Haz 2018 07:54:1922.06.2018
alıcı ang...@googlegroups.com
Hi Guys 

What do i do with this

i've passed a value into a this.FormControl.setValue(this.Info.name)
and the error says that it cannot read property 'name of undefined,
but i tried two ways

one is declaring the 'Info' variable as any and with specified interface
but the error still persist 


though the good part is that it still executes in the page, yet the DOM is having an error


Much appreciated for those who can answers :)

Good Day!

khushbu poddar

okunmadı,
22 Haz 2018 09:42:1522.06.2018
alıcı ang...@googlegroups.com
Hello Jamester,
 Just Declaring the variable is not enough. We need variable to be defined
 Say,
      public info: Info = new Info();

And Info class may be declared as below,

    class Info{
        name: string;
    }


--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Tümünü yanıtla
Yazarı yanıtla
Yönlendir
0 yeni ileti