일부 변수에 따라 적용 할 수있는 네 가지 가능한 스타일 파일이있는 구성 요소가 있습니다. 렌더링하기 전에 해당 구성 요소의 스타일을 어떻게 적용 할 수 있습니까?프로그래밍 방식으로 구성 요소에 스타일 2를 적용하는 방법은 무엇입니까?
@Component({
selector: 'settings-editor',
templateUrl: './settings-editor.component.html',
styleUrls: [ './a.less', './b.less' , './c.less' ]
})
export class SettingsEditorComponent implements OnInit {
@Input()
public styleType: string;
ngOnInit() {
if (this.styleType === 'A') {
// Apply styles from a.less only
}
}
}