0

i want to have a route to a popup dialog. I created a viewmodel with @noView

import {noView} from "aurelia-framework";

@noView()
export class MyViewModel{
     ...
}

but this leads to this error:

aurelia-logging-console.js:54 ERROR [app-router] TypeError: Cannot set property 'bindingContext' of null

In my opinion showing the popup from my navbar.ts is not suitable as i don't like to have such code in the navbar, i rather would have it on a place more suitable.

What is the best way to show a popup from navbar without losing the current content of the page so basically show it from anywhere and also with no code in navbar.ts at all.

Is there a better and nicer way to achive this? Should i rethink my page layout?

Thanks.

l1e3e3t7
  • 124
  • 11
  • 1
    I don't think I'm following you. Would you mind creating a gist.run example? – Ashley Grant Nov 19 '16 at 23:22
  • Well, let's say someone wants to show a "signup for newletter" popup. How would you implement it? And let's say the button which opens the popup is visible on all pages. – l1e3e3t7 Nov 19 '16 at 23:37
  • @AshleyGrant I will try to make a gist. – l1e3e3t7 Nov 19 '16 at 23:54
  • 2
    @paranoxx you don't need to make this a composed view model just create a module that creates the popup and import / inject it to any view model code you want it to show up on. – PW Kad Nov 20 '16 at 00:33
  • @PWKad My way of thinking was way too complicated. Thanks, that's perfect. – l1e3e3t7 Nov 20 '16 at 00:38

1 Answers1

0

I'd look up for event aggregator in this situation.
Where clicking a link or pressing a button will send an event and you can handle this event straight in the app.ts
So you will require your subscription behavior only in app and send an event to activate the popup from anywhere you want.

gl hf (-:

Alexander Taran
  • 6,655
  • 2
  • 39
  • 60