Hi Janis,

You can do something like this:
@Component({
selector: 'hello',
template: `<h1>Hello {{name}}!</h1>
<ng-container *ngIf="data$|async as data">
<ul>
<li *ngFor="let post of data.posts">{{post.title}}</li>
</ul>
</ng-container>
<pre>{{data$|async|json}}</pre>
`,
styles: [`h1 { font-family: Lato; }`]
})
export class HelloComponent {
data$ = this.http.get(
'https://public-api.wordpress.com/rest/v1.1/sites/idcdistro.wordpress.com/posts/?author=ajpRspthis&number=10&pretty=true'
)

@Input() name: string;
constructor(private http:HttpClient){}
}

See it in action on stackblitz 
<https://stackblitz.com/edit/angular-595spa?file=app%2Fhello.component.ts>

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to