diff --git a/projects/components/src/radio/radio-group.component.ts b/projects/components/src/radio/radio-group.component.ts index a2d2488b0..ee8c07f0c 100644 --- a/projects/components/src/radio/radio-group.component.ts +++ b/projects/components/src/radio/radio-group.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core'; import { MatRadioChange } from '@angular/material/radio'; import { LoggerService } from '@hypertrace/common'; import { RadioOption } from './radio-option'; @@ -22,10 +22,16 @@ import { RadioOption } from './radio-option'; [ngClass]="[this.optionsDirection, this.disabled ? 'disabled' : '']" [value]="option.value" > - + {{ option.description }} + ` }) export class RadioGroupComponent implements OnInit { @@ -67,6 +73,10 @@ export class RadioGroupComponent implements OnInit { this.selected = this.options.find(option => option.value === event.value); this.selectedChange.emit(event.value); } + + public isLabelAString(label: string | TemplateRef): boolean { + return typeof label === 'string'; + } } export const enum OptionsDirection { diff --git a/projects/components/src/radio/radio-option.ts b/projects/components/src/radio/radio-option.ts index d7c3b10cb..e38c28f03 100644 --- a/projects/components/src/radio/radio-option.ts +++ b/projects/components/src/radio/radio-option.ts @@ -1,5 +1,7 @@ +import { TemplateRef } from '@angular/core'; + export interface RadioOption { value: string; - label: string; + label: string | TemplateRef; description?: string; }