<body>
<nav-menu><search><your-search-component-particular-for-the-current-page></your-search-component-particular-for-the-current-page></search></nav-menu>
<router-outlet></router-outlet>
</body>
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { BehaviorSubject } from 'rxjs';
@Injectable()
export class FilmDataService{
public films$ = new BehaviorSubject<any[]>([]);
constructor(private http: HttpClient) {
}
getFilms(query) {
this.http.get<any[]>('url', {params: {query}}).subscribe(films => {
this.films$.next(films);
})
}
}
<search (onQuery)="filmsDataService.getFilms($event)">
<result [items]="filmsDataService.films$ | async">
let function2 = function() {
code..
}
export {function2}
В перле не силён, как это видно из примера. Не смог сделать одним выражением...