Html:
<map street="{{firstunit.street}}"/>
Component:
@Component('CustomerService', {
templateUrl: '/CustomerService/_UnitCard/MapComponent/Map.html',
selector: 'map',
bindings: {
street: '@',
}
})
export class MapComponent {
private x: string;
public $onInit() {
this.x = 'y';
}
public getValue() {
console.log(this.x);
}
}
I have a class that uses a $onInit to set a value. But I can't use that value in another function. When I call the function getValue()
I log a 'undefined'. How can I set a value to the class property using a $onInit? (using angular 1.7 with typescript).