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
| import React, { useState, useEffect } from 'react'; | |
| import './style.css'; | |
| import { interval } from 'rxjs'; | |
| export default function App() { | |
| const [state, setState] = useState(); | |
| return ( | |
| <div> | |
| <h1>Hello RxJS!</h1> |
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
| import React, { useState, useEffect } from 'react'; | |
| import './style.css'; | |
| import { interval } from 'rxjs'; | |
| export default function App() { | |
| const [state, setState] = useState(); | |
| const observable$ = interval(1000); | |
| useEffect(() => { |
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
| import { HttpClient } from '@angular/common/http'; | |
| import { Injectable } from '@angular/core'; | |
| import { Observable } from 'rxjs'; | |
| import { tap } from 'rxjs/operators'; | |
| import { ToDo } from './model'; | |
| @Injectable({ providedIn: 'root' }) | |
| export class TodoService { | |
| private todoUrl = 'https://jsonplaceholder.typicode.com/todos/1'; |
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
| import { Component, OnDestroy, OnInit } from '@angular/core'; | |
| import { Subscription } from 'rxjs'; | |
| import { TodoService } from './todo.service'; | |
| import { ToDo } from './model'; | |
| @Component({ | |
| selector: 'my-app', | |
| templateUrl: './app.component.html', | |
| styleUrls: ['./app.component.css'], | |
| }) |
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
| import { HttpClient } from '@angular/common/http'; | |
| import { Injectable } from '@angular/core'; | |
| import { tap } from 'rxjs/operators'; | |
| @Injectable({ providedIn: 'root' }) | |
| export class TodoService { | |
| private todoUrl = 'https://jsonplaceholder.typicode.com/todos/1'; | |
| constructor(private http: HttpClient) {} |
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
| import { Component } from '@angular/core'; | |
| import { TodoService } from './todo.service'; | |
| @Component({ | |
| selector: 'my-app', | |
| templateUrl: './app.component.html', | |
| styleUrls: ['./app.component.css'], | |
| }) | |
| export class AppComponent { | |
| data$ = this.todoService.todo$; |
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
| <div> | |
| <label for="email">Email</label> | |
| <input | |
| type="email" | |
| id="email" | |
| name="email" | |
| [(ngModel)]="email" | |
| /> | |
| </div> |
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
| <div> | |
| <form (ngSubmit)="onSubmit(f)" #f="ngForm"> | |
| <div> | |
| <label for="name">Name</label> | |
| <input type="text" id="name" name="name" [(ngModel)]="name" required /> | |
| </div> | |
| <div> | |
| <label for="email">Email</label> | |
| <input type="email" id="email" name="email" [(ngModel)]="email" /> | |
| </div> |
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
| <div> | |
| <form (ngSubmit)="onSubmit()"> | |
| <div> | |
| <label for="name">Name</label> | |
| <input type="text" id="name" name="name" [(ngModel)]="name" required /> | |
| </div> | |
| <div> | |
| <label for="email">Email</label> | |
| <input type="email" id="email" name="email" [(ngModel)]="email" /> | |
| </div> |
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
| import { Component, OnInit } from '@angular/core'; | |
| import { Observable, of } from 'rxjs'; | |
| @Component({ | |
| selector: 'app-root', | |
| templateUrl: './app.component.html', | |
| }) | |
| export class AppComponent implements OnInit { | |
| numbers$: Observable<number[]>; |
OlderNewer