\ No newline at end of file
diff --git a/src/app/components/posts/posts.component.ts b/src/app/components/posts/posts.component.ts
index 2e311e0..d30d79c 100644
--- a/src/app/components/posts/posts.component.ts
+++ b/src/app/components/posts/posts.component.ts
@@ -3,6 +3,12 @@ import { DataloaderService } from 'app/services/dataloader.service';
import { Post } from '../../model/post';
import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/operator/map';
+import 'rxjs/add/operator/merge';
+import 'rxjs/add/operator/concatMap';
+import 'rxjs/add/observable/from';
+import 'rxjs/add/operator/distinct';
+
@Component({
selector: 'app-posts',
templateUrl: './posts.component.html',
@@ -10,6 +16,7 @@ import { Observable } from 'rxjs/Observable';
})
export class PostsComponent implements OnInit {
+ postTypes: Observable;
posts:Observable;
constructor(private dataloaderService:DataloaderService) { }
@@ -17,6 +24,25 @@ export class PostsComponent implements OnInit {
ngOnInit() {
//fetch the posts
this.posts = this.dataloaderService.getPosts();
+ this.postTypes = this.getPostTypes();
+ this.postTypes.subscribe(test=>{
+ console.log('result of subscribe: '+test);
+ });
}
+ getPostTypes():Observable {
+ return this.posts.map(posts=>{
+ let result = new Set();
+ for(let post of posts) {
+ result.add(post.type);
+ }
+ console.log('got these post types!');
+ console.log(result);
+ return Array.from(result);
+ });
+ }
+
+ filterOnType(type:String): void {
+
+ }
}
diff --git a/src/app/pipes/posttypepipe.pipe.spec.ts b/src/app/pipes/posttypepipe.pipe.spec.ts
new file mode 100644
index 0000000..2a49235
--- /dev/null
+++ b/src/app/pipes/posttypepipe.pipe.spec.ts
@@ -0,0 +1,8 @@
+import { PosttypepipePipe } from './posttypepipe.pipe';
+
+describe('PosttypepipePipe', () => {
+ it('create an instance', () => {
+ const pipe = new PosttypepipePipe();
+ expect(pipe).toBeTruthy();
+ });
+});
diff --git a/src/app/pipes/posttypepipe.pipe.ts b/src/app/pipes/posttypepipe.pipe.ts
new file mode 100644
index 0000000..6c3ce84
--- /dev/null
+++ b/src/app/pipes/posttypepipe.pipe.ts
@@ -0,0 +1,13 @@
+import { Pipe, PipeTransform } from '@angular/core';
+import { Post } from 'app/model/post';
+
+@Pipe({
+ name: 'posttypepipe'
+})
+export class PosttypepipePipe implements PipeTransform {
+
+ transform(posts: Post[], args?: any): any {
+ return posts.filter(post=>post.type == args);
+ }
+
+}
diff --git a/src/assets/post/blog/first/full.html b/src/assets/post/blog/first/full.html
index c71a3c6..3ecd77c 100644
--- a/src/assets/post/blog/first/full.html
+++ b/src/assets/post/blog/first/full.html
@@ -1,3 +1,3 @@
It's been on my mind for a while now to create an oldschool homepage. So, here it is. An homage to the old and tried Web 1.0, whoever thought static webpages were done and dusted is wrong! This will be a collection of some technical things I want to remind myself about so I don't have to look them up again and again, miscellaneous pictures of projects (in-progress or done) or anything that comes to mind I'd like to share on something other than the usual social media suspects.
-
Besides, it's nice to have an Angular2/Bootstrap playground to test some stuff out. I'll probably update this thing once in a while. Maybe even use a database, wouldn't that be something...
\ No newline at end of file
+
Besides, it's nice to have a minimalistic Angular2/Bootstrap playground to test some stuff out. I'll probably update this thing once in a while. Maybe even use a database, wouldn't that be something...