(this was originally incorrectly posted in the Omega section)
Hi,
I am trying to dynamically update the badge value after the initial render, is there a simple way of doing this that I am missing?
For example
badgeValue: number = 10;
...
items: [
{ label: 'All Incoming', icon: 'im-icon im-icon-phone-incoming', badge:badgeValue:number , routerLink: ['/calls/all'] },
...
10 will be correctly displayed as badge number.
However, updating badgeValue = 12 will not reset the badge value displaying the rendered menu. What am I missing?
Many thanks.
Phil
Updating Badge Values
Forum rules
Please note that response time for technical support is within 3-5 business days.
Please note that response time for technical support is within 3-5 business days.
Can you try this?
Code: Select all
...
badgeValue : number;
items: [
{ label: 'All Incoming', icon: 'im-icon im-icon-phone-incoming', badge:10 , routerLink: ['/calls/all'] },
...
Code: Select all
this.items[0].badge = this.badgeValue;
-
- Posts: 7
- Joined: 12 Feb 2017, 23:56
Thanks for the reply.
Yes that would definitely work and is how I have since implemented it
I guess I was just wondering if there were an easier way to bind to a variable / or a best practice etc.
Yes that would definitely work and is how I have since implemented it
Code: Select all
for (var i in this.model) {
if ( this.model[i].label == "Call Activity") {
for (var n in this.model[i].items) {
switch (this.model[i].items[n].label) {
case "All Incoming":
this.model[i].items[n].badge = data.total;
break;
case "Voicemail":
this.model[i].items[n].badge = data.vm;
break;
default:
break;
}
}
break; //Stop this loop, we found it!
}
}
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
We can't think of another way at the moment.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 1 guest