add new value for repair cod /hero-detail.component.ts
This commit is contained in:
parent
b0153ebb86
commit
80c0236f5e
|
@ -3,10 +3,11 @@ import { Component, OnInit } from '@angular/core';
|
|||
import { Hero } from '../hero';
|
||||
import { HeroService } from '../hero.service';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { HeroSearchComponent } from "../hero-search/hero-search.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-dashboard.component',
|
||||
imports: [CommonModule, RouterLink],
|
||||
imports: [CommonModule, RouterLink, HeroSearchComponent],
|
||||
templateUrl: './dashboard.component.html',
|
||||
styleUrl: './dashboard.component.css'
|
||||
})
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
|
||||
import {
|
||||
debounceTime, distinctUntilChanged, switchMap
|
||||
} from 'rxjs/operators';
|
||||
|
||||
import { Hero } from '../hero';
|
||||
import { HeroService } from '../hero.service';
|
||||
import { CommonModule } from '@angular/common'; //добавил библиотеку
|
||||
import { RouterLink } from '@angular/router'; //добавил библиотеку
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-hero-search',
|
||||
imports: [CommonModule, RouterLink],
|
||||
templateUrl: './hero-search.component.html',
|
||||
styleUrls: [ './hero-search.component.css' ]
|
||||
})
|
||||
|
@ -20,11 +21,6 @@ export class HeroSearchComponent implements OnInit {
|
|||
|
||||
constructor(private heroService: HeroService) {}
|
||||
|
||||
// Push a search term into the observable stream.
|
||||
search(term: string): void {
|
||||
this.searchTerms.next(term);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.heroes$ = this.searchTerms.pipe(
|
||||
// wait 300ms after each keystroke before considering the term
|
||||
|
@ -38,9 +34,6 @@ export class HeroSearchComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
private searchTerms = new Subject<string>();
|
||||
|
||||
// Push a search term into the observable stream.
|
||||
search(term: string): void {
|
||||
this.searchTerms.next(term);
|
||||
|
|
Loading…
Reference in New Issue