我有以下课程
fields
在export class PracticeQuestionsListAPI {
'list':UserOverview[];
'page-info':string;
constructor(public pageState:string, public usersList:UserOverview[]){
this['page-state'] = pageState;
this['users-list'] = usersList;
}
}
组件的HTML中,仅当Angular
不是空字符串时,才想显示button
。我该怎么办?
我已经写过类似的东西,但是没有编译。
page-state
我也尝试过<button *ngIf="!this.users['page-state'].isEmpty()" (click)="getNextPage()" id="next-page-button" class="btn content-div__button--blue btn-sm">Next Page</button>
,但这也不能编译
答案 0 :(得分:1)
这应该很好
<button *ngIf="this.users['page-state'].length>0" (click)="getNextPage()" id="next-page-button" class="btn content-div__button--blue btn-sm">Next Page</button>
或此
<button *ngIf="this.users['page-state'].length>!==''" (click)="getNextPage()" id="next-page-button" class="btn content-div__button--blue btn-sm">Next Page</button>