Ali B
Ali B

Reputation: 1117

Durandal 2.0 router access

I am playing around with the Durandal 2.0 starter kit. Everything works fine out of the box, but the moment I try to include the 'durandal/plugins/router' module, the page hangs. All I want is to get access to the current route and the query strings from my viewmodel. In Durandal 1.2, I could just access the routeInfo that's passed to the activate() function, but now this parameter is always null. How is this done in 2.0?

Thanks

Upvotes: 1

Views: 916

Answers (1)

RainerAtSpirit
RainerAtSpirit

Reputation: 3723

The path to the router has changed in 2.0 and is now plugins/router. Within main.js you should see a require.config block that is responsible for the path mapping.

requirejs.config({
    paths: {
        'text': '../lib/require/text',
        'durandal':'../lib/durandal/js',
        'plugins' : '../lib/durandal/js/plugins',
        ...
});

Edit: Answered in google groups https://groups.google.com/forum/#!topic/durandaljs/jRzCQzU5XIg by @EisenbergEffect

Curretly there's no way to get the route info. You can get the parameters though. Your activate function will get called with one argument per parameter.

Upvotes: 2

Related Questions