Skip to content

Instantly share code, notes, and snippets.

@Med116
Created November 7, 2018 11:58
Show Gist options
  • Save Med116/c29929185295040268e61eb098dbae72 to your computer and use it in GitHub Desktop.
Save Med116/c29929185295040268e61eb098dbae72 to your computer and use it in GitHub Desktop.
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