标签:ack bsp const back 代码 cli angular fms message
此方法采用的是没有路由的方式;
html5 代码:
<div [hidden]="flag"> <li class="music-list-datails">热门</li> <li class="music-list-datails" *ngFor="let c of category" [class.selected]="c === selectedc" (click)="onSelect(c)">{{c.category_name}}</li> </div> <div *ngIf="selectedc"> <li class=" swiper-slide music-list-datails " (click)="goback()">返回上一级</li> <li class="swiper-slide music-list-datails " *ngFor="let audio of selectedc ">{{audio.tag_name}}</li> </div> ts代码:
ts代码:
errorMessage: string; category: Category[]; selectedc: Tag[]; flag; constructor(private fmService: FMService, private location: Location) { } ngOnInit() { this.getCategoryList(); } getCategoryList() { this.fmService.getCategoryList().then( category => { this.category = category; }, error => this.errorMessage = <any>error ) } onSelect(c): void { this.fmService.getAudiobook(c.id).then( tag => { this.selectedc = tag; this.flag = true; }, error => this.errorMessage = <any>error ) }
标签:ack bsp const back 代码 cli angular fms message
原文地址:http://www.cnblogs.com/sulishibaobei/p/7371719.html