I am having a question.I am using angular 4 and I want to to inject data of one component to other component,but it is not showing the data there.
I want to show the PopupComponent html data also in AppComponent
i.e. in app.component.html file.But with below things it is not showing the data from html file of PopupComponent in app.component.html
This is my code snippet :
import { Component} from ‘@angular/core’;
import { PopupComponent } from ‘./popup.component’; //other component
@Component({
selector: ‘app-root’,
templateUrl: ‘./app.component.html’,
styleUrls: [‘./app.component.css’]
})
export class AppComponent {
description=””;
ngOnInit(){
this.description = this.createPopupText();
}
createPopupText():string{
//here I want to return the PopupComponent data
//<pop-up> is the selector tag of PopupComponent
popUptext = “My popup text ”+”<pop-up></pop-up>”;
return popUptext;
}
}