Reputation: 16747
I have the following class
export class PracticeQuestionsListAPI {
'list':UserOverview[];
'page-info':string;
constructor(public pageState:string, public usersList:UserOverview[]){
this['page-state'] = pageState;
this['users-list'] = usersList;
}
}
In my Angular
's component's HTML, I want to show a button
only if page-state
is not an empty string. How could I do it?
I have written something like this but it doesn't compile.
<button *ngIf="!this.users['page-state'].isEmpty()" (click)="getNextPage()" id="next-page-button" class="btn content-div__button--blue btn-sm">Next Page</button>
I also tried *ngIf="!(this.questions['page-state'] =="")"
but that doesn't compile either
Upvotes: 0
Views: 8797
Reputation: 158
this should work fine
<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>
or this
<button *ngIf="this.users['page-state'].length>!==''" (click)="getNextPage()" id="next-page-button" class="btn content-div__button--blue btn-sm">Next Page</button>
Upvotes: 2