|
[ts]
onClick(event) {
var data = "Simple Dialog";
var obj = $("#termsDialog").ejDialog("instance");
obj.setContent(data); // set the content dynamically.
}
onClick1(event) {
$("#termsDialog").ejDialog("close"); //to hide the dialog
}
onClick2(event) {
$("#termsDialog").ejDialog("open"); // to show the dialog
}
onClick3(event) {
$("#termsDialog").ejDialog("destroy"); //to destroy the dialog as well as remove the dom
} |
Hello Selvamani ,
I'm not sure you got what I mean.
I want to load Angular components dynamically, not just simple html content.
So, If I have an Angular component named: add.user.component
I want to load this component dynamically when the user clicks on Add User button.
Hello Selvamani ,
- <button type="button" class="btn btn-primary" (click)="openModalWithComponent()">Create modal with component</button>
|
[app.component.ts]
import { Component, ViewChild } from '@angular/core';
import { EJComponents } from 'ej-angular2';
@Component({
selector: 'ej-app',
template: ` <h2>Dialog</h2>
<button id="clearTxt" (click)="buttonclick($event)">Open Dialog</button>
<ej-dialog #dialog title="Dialog" id="dialog" [showOnInit]="false"></ej-dialog>`
})
export class AppComponent {
@ViewChild('dialog') dialog: EJComponents<any, any>;
constructor() {
}
buttonclick(e){
this.dialog.widget.open();
}
} |
Hi Selvamani,
You still don't get what I mean.
Yes, I want to invoke:
this.modalService.show(ModalContentComponent);
But you missed the most important thing which is the thing I want. The passed parameter.
You shared this method earlier:
|
[grid.component.ts]
ngAfterViewInit() {
let componentFactory = this.componentResolver.resolveComponentFactory(Newcomponent);
const ref = this.viewContainerRef.createComponent(componentFactory);
this.dialog.widget.setContent(ref._view.nodes[0].renderElement);
}
buttonclick(e) {
this.dialog.widget.open();
} |
Hello Selvamani,
Is this added to documentation? If yes can you please share link.
Thank you!!
Ambdas, Currently, we are focusing on the EJ2 and Blazor platforms and not considering improvements to the EJ1 platform. We have already created a general blog to achieve this same requirement in EJ2 Dialog. Check out the below link.
We suggest you make use of our EJ2 component and check the shared details. You can revert to us if you need any further assistance.