Answer the question
In order to leave comments, you need to log in
How to pass data from one component to another in Angular 2?
Hello.
How can I pass html code from one component to another.
The meaning is this.
I created a modal window and I want to use one modal window on the entire site, that is, when a button is pressed, a window with content is called, when another button is clicked, the same window is called but with different content.
modal.component.ts
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector:'app-modal',
template: `
<div class="modal-body">
<modal-content></modal-content>//Сюда должен передаваться новый контент
</div>
`
})
export class ModalComponent {
modalTitle:string = 'Modal';
}
import { Component } from '@angular/core';
@Component({
selector: 'modal-content',
template: , // То есть сюда я должен подставлять новый контент?
})
export class ModalContentComponent {
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question