I want give my users an opportunity to choose which type of input to use to select color: type='text' or type='color'. So, I wrote this template:
<input [type]="colorInputTypeText ? 'text' : 'color'">
<input type="checkbox" [(ngModel)]="colorInputTypeText" name="colorInputTypeText">
And in my-component.ts:
@Component({
...
})
export class MyComponent {
colorInputTypeText = true;
...
}
My question is: is it allright to declare colorInputTypeText as a field of MyComponent class, or I should declare it somehow locally in template? If the right answer is "in template", how to do that?
Thanks.