this.postService.getPostByName(name)
.pipe(
switchMap(post => this.postService.getTagsByPostId(post.id)
.pipe(
tap(tags => post.tags = tags),
mapTo(post),
filter(() => post.hasComments),
switchMap(() => this.postService.getCommentsByPostId(post.id)),
tap(comments => post.comments = comments),
mapTo(post),
)
),
)
save_custom(): Observable<void> {
return this.createFile()
.pipe(
tap(() => this.save_order()),
);
async save_custom(): Promise<void> {
await this.createFile();
return await this.save_order();
function capitilize(str = '') {
const words = str.split(' ');
const capitilized = words.map(word => {
const letters = word.split('');
letters[0] = letters[0].toUpperCase();
return letters.join('');
});
return capitilized.join(' ');
}
const necessarySpan = document.querySelector('div.your-class > span');
document.removeChild(necessarySpan);
<div *ngFor="let item of items"> {{ item }} </div>
<button (click)="addItem()">Add</button>
items = [1, 2, 3, 4];
addItem(): void {
this.items.push(5);
}
search(title: string): void {
const params = new HttpParams()
.set('api_key', 'd6a5ac2d3d7cab11a084ca8080421b20')
.set('title', title);
const url = 'https://api.themoviedb.org/3/movie/search';
this.httpClient.get(url, { params })
.subscribe(console.log);
}
@Input()
public value: string;
@Output()
public valueChange: EventEmitter<string>;
text_val = new FormControl();
<input type="text" name="arr_text[]" [formControl]="text_val">
<input type="text" name="arr_text[]" [formControl]="text_val">
<input type="text" name="arr_text[]" [formControl]="text_val">
<input type="text" name="arr_text[]" [formControl]="text_val">
this.text_val.value
<app-products (clicked)=“onClicked($event)”></app-products>
. Создаёшь в home компоненте свойство data и присваиваешь только что пойманные данные в методе onClicked. То есть onClicked(data) { this.data = data; }. <app-wishlist [data]=“data”></app-wishlist>.
Ещё раз, сервис для такого простого действия городить не нужно.