У меня есть это в моем HTML файле:
<div>
<ng-template #valueTemplate>
</ng-template>
</div>
Как я могу установить внутренний Html ng-template
, используя мою локальную ссылку #valueTemplate
из компонента?
Я пробовал это, но это не работает:
import { Component, OnInit, ViewChild } from '@angular/core';
@Component({
selector: 'app-some',
templateUrl: './some.component.html',
styleUrls: ['./some.component.css'],
})
export class SomeComponent implements OnInit {
@ViewChild('valueTemplate', { static: false }) valueTemplate;
ngOnInit() {
this.postContentEditContent.innerHTML(data.content); // Doesn't work
this.postContentEditContent.value(data.content); // Doesn't work
this.postContentEditContent.setValue(data.content); // Doesn't work
this.postContentEditContent.textContent(data.content); // Doesn't work
}
}
Как я могу установить его значение из компонента?