I am dabbling with learning Angular 4 and I am running into a stumbling block.
I have the following app/content.component.ts file:
import { Component, Input, OnInit } from '@angular/core';
import { AngularFire, FirebaseListObservable } from 'angularfire2';
import { Content } from './content';
@Component({
selector: 'app-content',
templateUrl: './content.component.html'
})
export class ContentComponent implements OnInit {
@Input() loadScripts: string;
items: FirebaseListObservable<any[]>;
constructor(af: AngularFire) {
this.items = af.database.list('/pages', {
query: {
orderByChild: 'sortOrder',
limitToLast: 100
}
});
}
ngOnInit() {
console.log(this.loadScripts);
}
}
I have the following app/content.component.html file:
<div id="content-{{item.$key}}" *ngFor="let item of items | async | path : 'path'">
<h2>{{item.title}}</h2>
<div [innerHTML]="item.content | trustedHtml"></div>
</div>
"items" is a result set from Firebase. I need to pass the value of "item.loadScripts" to the loadScripts variable in the ContentComponent class.
How do I do this?