Reputation: 336
I want to pass selected item in list by selectQueries function to the componenet file but i m facing error like outlook is not a function on the console.
HTML File:-
<li>
<a href="#" style="width:auto" (click)="selectQueries(bottomBar.outlook) ">{{'bottomBar.outlook' | translate}}</a>
</li>
<li>
<a href="#" (click)="selectQueries(bottomBar.oneDrive)">{{'bottomBar.oneDrive' | translate}}</a>
</li>
<li>
<a href="#" (click)="selectQueries(bottomBar.restartingPC)">{{'bottomBar.restartingPC' | translate}}</a>
</li>
Component.ts file
selectQueries(query: string) {
this.translate.use(query);
this.currentQuery = query;
console.log('here',this.currentQuery);
}
but here i m getting undefined response.
bottombar data present on bt.json:-
"bottomBar":{
"outlook": "Invites keep getting deleted in Outlook",
"oneDrive": "Access to OneDrive",
"restartingPC":"My PC keeps restarting"
},
Upvotes: 0
Views: 39
Reputation: 1209
Try to put async & await -
async selectQueries(query: string) {
await this.translate.use(query);
await this.currentQuery = query;
console.log('here',this.currentQuery);
}
Upvotes: 2