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
users, notusers-list. UsepageState, notpage-state. And declare the properties you're using. Then simply use*ngIf="pageState", or if you really want to accept null and undefined, but not the empty string, use*ngIf="pageState !== ''".*ngIf="!this.users['page-state']", It will check empty, null and undefined.