Created
January 18, 2017 20:51
-
-
Save vigohe/e07cabc69e2812a929bd9090cc223953 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, OnInit} from '@angular/core'; | |
import { NavController } from 'ionic-angular'; | |
import {BehaviorSubject, Observable} from "rxjs"; | |
@Component({ | |
selector: 'page-home', | |
template: ` | |
<ion-header> | |
<ion-navbar> | |
<ion-title>Home</ion-title> | |
</ion-navbar> | |
</ion-header> | |
<ion-content padding> | |
<ion-badge *ngFor="let tag of tags | async">{{tag.name}}</ion-badge> | |
</ion-content> | |
` | |
}) | |
export class HomePage implements OnInit{ | |
tags : BehaviorSubject<any> = new BehaviorSubject([]); | |
constructor(public navCtrl: NavController) { | |
} | |
ngOnInit(){ | |
Observable.interval(2000) | |
.map(id => { | |
return { id: id, name: 'tag ' + id | |
}; | |
}) | |
.bufferWhen(() => Observable.interval(5000)) | |
.subscribe(tags => this.tags.next(tags)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment