Я хочу добавить некоторое HTML-содержимое в div, используя угловые 5 и машинописный текст.
Вот мой div, к которому я хочу добавить <div class = "parent">
Вот мой HTML-контент, который яхочу добавить -> component.html
<div #notification class="notification-top-bar" [ngClass]="type" style="display: block;">
</div>
У меня нет прав на изменение <div class = "parent"></div>
.
Здесьмой component.ts
export class SiteNotificationComponent implements OnInit {
@ViewChildren('notification') private notificationsElements: QueryList<ElementRef>;
constructor() {
}
ngOnInit() {
}
}
Хотите сделать что-то подобное ->
var d1 = document.getElementsByClassName('parent');
d1.insertAdjacentHTML('beforeend', '<div #notification class="notification-top-bar" [ngClass]="type" style="display: block;"></div>');