I am attempting to use aurelia-dialog to open a popup from my main view model.
When I try to use:
this.dialogService.open, I get the following error:
aurelia-dialog.js:292 Uncaught TypeError: Cannot read property 'createChild' of undefined
at DialogService.open (VM189 entry-bundle.js:18912)
at Customer.open_consolidations (VM189 entry-bundle.js:199)
at CallScope.evaluate (VM189 entry-bundle.js:13641)
at Listener.callSource (VM189 entry-bundle.js:17370)
at Listener.handleEvent (VM189 entry-bundle.js:17379)
at DelegateHandlerEntry.handleEvent (VM189 entry-bundle.js:15441)
I have created a gist to show my error:
Any insight is appreciated.
I’ve played a little bit with you gist, but didn’t find the reason for the error.
but just as an FYI: you use
querySelector to get a reference to a
div in the view.
you should use
also: if you use aurelia correctly - you should not have the need for JQuery at all…
There are many mistakes in your code.
- the usage of dependency injection in constructor is wrong. The component should not create an instance of a class by itself, that’s the very reason of using depedency injection (acquire dependency from outside, not creating).
- missing dependency DialogController in the dialog js code.
- missing dom
<ux-dialog> in dialog html code, wrong tag
<ux-dialog-header>, and you have no local
<title></title> would not work, title is a special tag name used in html head section, it’s by default not displayed when using in html body section.
Thank you for your fixes. I am now moving this stuff into my app, and hopefully it goes well.