Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Injectable } from '@angular/core';
- import { Subject } from 'rxjs';
- import { CarsRemoteService } from './cars-remote.service';
- import { search } from './search.operator';
- @Injectable()
- export class CarsV3Service {
- private carsQuerySubject = new Subject<string>();
- readonly cars$ = this.carsQuerySubject.pipe(
- search(query => this.carsRemoteService.loadCars(query))
- );
- constructor(private carsRemoteService: CarsRemoteService) { }
- searchCars(query: string) {
- this.carsQuerySubject.next(query);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement