May 2018
Intermediate to advanced
512 pages
11h 3m
English
By definition, your parent component will be aware of what child components it is working with. Since the currentWeather property is bound to the current property on the current-weather component, the results pass down to be displayed. This is achieved by creating an @Input property:
src/app/current-weather/current-weather.component.tsimport { Component, Input } from '@angular/core'...export class CurrentWeatherComponent implements OnInit { @Input() current: ICurrentWeather ...}
You can then update app component to bind the data to current weather:
src/app/app.component.tstemplate: ` ... <app-current-weather [current]="currentWeather"></app-current-weather> ...`
This approach may be appropriate ...
Read now
Unlock full access