Skip to content

Commit 2ae5890

Browse files
authored
Merge pull request #8084 from IgniteUI/badge-refactor-10-1
fix(badge): adding type for value #8077
2 parents 180899c + 1bca5c7 commit 2ae5890

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

projects/igniteui-angular/src/lib/badge/badge.component.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class IgxBadgeComponent {
8787
* ```
8888
*/
8989
@Input()
90-
public value = '';
90+
public value: string | number = '';
9191

9292
/**
9393
* Sets/gets an icon for the badge from the material icons set.
@@ -154,18 +154,13 @@ export class IgxBadgeComponent {
154154
* @internal
155155
*/
156156
get roleDescription() {
157-
let message: string;
158-
159157
// tslint:disable-next-line:prefer-conditional-expression
160158
if (this.icon) {
161-
message = this.type + ' type badge with icon type ' + this.icon;
162-
} else if (this.value) {
163-
message = this.type + ' badge type with value ' + this.value;
164-
} else {
165-
message = this.type + ' badge type without value';
159+
return this.type + ' type badge with icon type ' + this.icon;
160+
} else if (this.value || this.value === 0) {
161+
return this.type + ' badge type with value ' + this.value;
166162
}
167-
168-
return message;
163+
return this.type + ' badge type without value';
169164
}
170165

171166
/**

0 commit comments

Comments
 (0)