https://stackoverflow.com/questions/44210786/style-not-working-for-innerhtml-in-angular
import { Component, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'example',
styles: ['.demo {background-color: blue}'],
template: '<div [innerHTML]="someHtmlCode"></div>',
encapsulation: ViewEncapsulation.None,
})
export class Example {
private someHtmlCode = '';
constructor() {
this.someHtmlCode = '<div class="demo"><b>This is my HTML.</b></div>';
}
}
'FE > Angular' 카테고리의 다른 글
[ ANGULAR ] datatable 전체 선택 현재행으로 제한 (0) | 2022.12.27 |
---|---|
[ ANGULAR ] robot.txt 추가 (0) | 2022.12.27 |
[ ANGULAR ] Angular Router new tab (0) | 2022.07.20 |
[ ANGULAR ] Input keydown enter (0) | 2022.07.15 |
[ ANGULAR ] 새로고침 , back 버튼 막기 (0) | 2022.06.28 |