Created
March 21, 2022 15:33
-
-
Save lorenzojkrl/dcb4af33e86b1b48e344afdb2bc9fb13 to your computer and use it in GitHub Desktop.
Declarative
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) {} | |
todo$ = this.http.get(this.todoUrl).pipe(tap(console.log)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment