homepage/src/app/components/posts/posts.component.ts
2018-01-02 10:25:53 +01:00

23 lines
567 B
TypeScript

import { Component, OnInit } from '@angular/core';
import { DataloaderService } from 'app/services/dataloader.service';
import { Post } from '../../model/post';
import { Observable } from 'rxjs/Observable';
@Component({
selector: 'app-posts',
templateUrl: './posts.component.html',
styleUrls: ['./posts.component.css']
})
export class PostsComponent implements OnInit {
posts:Observable<Post[]>;
constructor(private dataloaderService:DataloaderService) { }
ngOnInit() {
//fetch the posts
this.posts = this.dataloaderService.getPosts();
}
}