/* subscribe 是异步方法 */
import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { ImageSlider, Channel } from 'src/app/shared/components';
import { ActivatedRoute } from '@angular/router';
import { HomeService } from '../../services';
import { filter, map } from 'rxjs/operators';
import { Observable } from 'rxjs/internal/Observable';
import { Subscription } from 'rxjs';
@Component({
selector: 'app-home-detail',
templateUrl: './home-detail.component.html',
styleUrls: ['./home-detail.component.css'],
changeDetection:ChangeDetectionStrategy.OnPush
})
export class HomeDetailComponent implements OnInit {
/* 变成数据流 Observable
async 相当于在模板中做subscribe 也不用脏值检查markForCheck()
*/
imageSliders$:Observable<ImageSlider[]>;
channels$:Observable<Channel[]>;
selectedTabLink$:Observable<string>;
sub:
angular8 管道和async
最新推荐文章于 2024-06-16 09:44:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)