This file contains hidden or 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
| Rx.Observable | |
| .range(1, 25) | |
| .last((value) => value % 3 === 0) | |
| .subscribe( | |
| (value) => console.log(`Emitted value: ${value}`), | |
| (error) => console.error(error), | |
| () => console.log('Completed') | |
| ); |
This file contains hidden or 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
| Rx.Observable | |
| .fromEvent(document, 'mousemove') | |
| .throttleTime(250) | |
| .take(7) | |
| .subscribe( | |
| (value) => console.log(`Emitted value: ${value}`), | |
| (error) => console.error(error), | |
| () => console.log('Completed') | |
| ); |
This file contains hidden or 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
| const stopButton = document.querySelector('#stop-button'); | |
| let isDone = false; | |
| Rx.Observable | |
| .fromEvent(stopButton, 'click') | |
| .first() | |
| .subscribe( | |
| () => isDone = true, | |
| (error) => console.error(error), |
This file contains hidden or 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
| const stopButton = document.querySelector('#stop-button'); | |
| const stop$ = Rx.Observable | |
| .fromEvent(stopButton, 'click') | |
| .first(); | |
| stop$ | |
| .subscribe( | |
| () => {}, | |
| (error) => console.error(error), |
This file contains hidden or 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
| const stopButton = document.querySelector('#stop-button'); | |
| const intervalSubscription = Rx.Observable | |
| .interval(1000) | |
| .subscribe( | |
| (value) => console.log(`Emitted value: ${value}`), | |
| (error) => console.error(error), | |
| () => console.log('Interval completed') | |
| ); |
This file contains hidden or 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
| @NgModule({ | |
| imports: [ | |
| BrowserModule, | |
| FormsModule, | |
| HttpModule, | |
| InMemoryWebApiModule.forRoot(InMemoryDataService), | |
| AppRoutingModule | |
| ], | |
| declarations: [ | |
| AppComponent, |
This file contains hidden or 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
| const routes: Routes = [ | |
| { path: 'dashboard', component: DashboardComponent } | |
| ]; | |
| @NgModule({ | |
| imports: [ | |
| RouterModule.forChild(routes) | |
| ], | |
| exports: [ | |
| RouterModule |
This file contains hidden or 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
| @NgModule({ | |
| imports: [ | |
| DashboardRoutingModule | |
| ], | |
| declarations: [ | |
| DashboardComponent | |
| ], | |
| exports: [ | |
| DashboardComponent | |
| ] |
This file contains hidden or 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
| imports: [ | |
| BrowserModule, | |
| FormsModule, | |
| HttpModule, | |
| InMemoryWebApiModule.forRoot(InMemoryDataService), | |
| AppRoutingModule, | |
| DashboardModule | |
| ] |
This file contains hidden or 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
| const routes: Routes = [ | |
| { path: 'detail/:id', component: HeroDetailComponent } | |
| ]; | |
| @NgModule({ | |
| imports: [ | |
| RouterModule.forChild(routes) | |
| ], | |
| exports: [ | |
| RouterModule |