Is there a way to inject HTML code from one Angular component into another using Angular 2 tags?
@Component({
selector: 'app-root',
template: '<app-a [my-html]="my-html"> </app-a>',
styleUrls: ['./app.component.css']
})
export class AppComponent {
my-html= '<span> {{variableFromAComponent}}</span>';
}
@Component({
selector: 'app-a',
template: '<div [innerHtml]="my-html"> </div>',
})
export class AComponent {
@Input('my-html') my-html:any;
public variableFromAComponent='its work!';
}
Despite setting up the components in this way, the expected result of "its work!" is not displayed due to the angular2 tags preventing the variable from rendering properly.