ankosoftware / ng2-bootstrap-modal

Library to simplify the work with bootstrap modal dialogs
MIT License
54 stars 63 forks source link

DialogService.createDialogHolder - Cannot read property '0' of undefined #56

Closed wernerva closed 5 years ago

wernerva commented 6 years ago

I duplicated the demo code but when I run it I get:

ERROR TypeError: Cannot read property '0' of undefined at DialogService.createDialogHolder (dialog.service.js:52) at DialogService.addDialog (dialog.service.js:33)

What gives?

Sky4CE commented 6 years ago

@wernerva , this probably fixed in my fork as I had similar errors, you can use it in your project just by reference my fork instead of npm version in your package,json, like this:

...
"dependencies": {
...
"ng2-bootstrap-modal": "https://github.com/Sky4CE/ng2-bootstrap-modal/tarball/v.1.0.2",
...
}
...
wernerva commented 6 years ago

@Sky4CE, thanks for that. Why don't you log a pull request if you've fixed the issue?

Sky4CE commented 6 years ago

@wernerva , because this lib no more maintained by the creator, unfortunately.

wernerva commented 6 years ago

Oh. Great.

Severus256 commented 6 years ago

I have created an issue. fix for that error is simple: use aplpicationRef.components[0] and don't reference on componentRoots or somethong like that

srinadh14 commented 6 years ago

Hi, I saw the post which is saying that "@wernerva , because this lib no more maintained by the creator, unfortunately." I have questions .

can we use this dialog service in our projects? Do we have any alternative for this?

MatthewRHT commented 6 years ago

var componentRootNode = componentRef.hostView.rootNodes[0]; // this is undefined, does anyone know the fix? this.container.appendChild(componentRootNode);

function DialogService(resolver, applicationRef, injector, config) { this.resolver = resolver; this.applicationRef = applicationRef; debugger this.injector = injector; this.container = config && config.container; }

After looking into it the injector is null, which in turn creates this error.

nanokul commented 6 years ago

@Sky4CE Thanks a lot man.

shashi97 commented 5 years ago

@Sky4CE this is not working with angular6, giving rxjs/oberable error, i think you should rxjs-compat