Created
November 7, 2018 11:58
-
-
Save Med116/c29929185295040268e61eb098dbae72 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 { Observable } from 'rxjs'; | |
@Component({ | |
selector: 'app-one', | |
template: `<ol> | |
<li *ngFor="let planet of planets$ | async"> {{ planet }} </li> | |
</ol> | |
`, | |
styleUrls: ['./one.component.css'] | |
}) | |
export class OneComponent implements OnInit { | |
constructor() { } | |
planets$: Observable<any>; | |
ngOnInit() { | |
this.planets$ = new Observable(o =>{ | |
o.next("Mercury"); | |
o.next("Venus"); | |
o.next("Earth"); | |
o.next("Mars"); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment