Aurelia-Dialog error on open

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.

1 Like

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 ref instead.
also: if you use aurelia correctly - you should not have the need for JQuery at all…

1 Like

There are many mistakes in your code.

  1. 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).
  2. missing dependency DialogController in the dialog js code.
  3. missing dom <ux-dialog> in dialog html code, wrong tag <ux-dialog-head>, it’s <ux-dialog-header>, and you have no local style.css.
  4. <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.
    https://gist.dumber.app/?gist=eea0870faa4b22b4978d8f8943267410
2 Likes

Thank you for your fixes. I am now moving this stuff into my app, and hopefully it goes well.

1 Like