How to set a property property of a model in angular 4

0

It seems to me that the property is undefined when you tried to initialize the property of an object at the start in the constructor. That happens in the template for example if I do not do this

Object? .firstname = 'a';

He tells me that firstname is indefinite. How do I do this in the typescript din tell me this

    
asked by santiago 29.11.2017 в 01:18
source

1 answer

0

To start the property of an object from the constructor you must access it with this.

this.tuObjeto.tuPropiedad = 'tuValor';
    
answered by 26.12.2017 в 22:09