I'm using Angular 2 in an Ionic 2 application. I would like to get a value from a template to use in my component. I know how to define a variable in my component and then use it in my template, but I'm looking for the other way around. Here's what I mean:
Component:
@Component({
template: '<ion-list [route]="path/on/site">
<ion-item *ngFor="let item of items">
{{title}}
</ion-item>
</ion-list>'
})
export class List {
route: string;
constructor() {
this.route = // should get value of [route] in template;
this.loadData( this.route );
}
loadData()...
}
I want to hardcode the value of [route] in the template, and then get that value in my component as this.route. [route] does not have to be on ion-list, it can be anywhere as long as I can get it into my component.
Thanks in advance.