I am trying to create generic controls like this
dynamic-control.ts
import { Component, Input } from '@angular/core';
@Component({
selector: 'ngo-button',
template: `<button [ngClass]=class type={{type}}>{{message}}</button>`,
styles: [`.one{border:solid 2px yellow} .two{background-color:pink} .three{
background-color: blue;
}`]
})
export class HelloComponent {
@Input() type: string = 'button';
@Input() class: string = 'one three';
@Input() message: string = 'submit';
}
main-component.html
<ngo-button [class]='btn two' (click)='somefunc()'></ngo-button>
now i want to pass two classes to the button, but when i am trying to pass it this way, i am getting error
[class]='btn two'
i suppose, we are not allowed to add space in the input parameter, is there another way to implement it?