Hash change not picked up on route

Turns out my full/ get function was wrong… :blush:

I have my routes defined like this:


route.data = router.route;


And my “router” like this:

import DefineMap from 'can-define/map/';
import resources from '~/resources';
import alerts from '~/alerts';
import localisation from '~/localisation';
import security from '~/security';
import stache from 'can-stache';

var Route = DefineMap.extend({
    resource: 'string',
    action: 'string',
    id: 'any',
    full: {
        get: function() {
            return this.resource + !!this.id ? `/${this.id}` : !!this.action ? `/${this.action}` : '';

var Router = DefineMap.extend({
    route: { Value: Route },
    previousHash: 'string',

    init: function () {
        const self = this;

        this.route.on('full', function () {

    process: function () {
		// find the correct "componentName"
        $('#application-content').html(stache('<' + componentName + '></' + componentName + '>')());

    goto: function(href) {
        window.location.hash = (href.indexOf('#!') === -1 ? '#!' : '') + href;

export default new Router();

However, if my url is, e.g., http://localhost:3969/development.html#!dashboard/2/1 and I change the 1 to anything else and press enter the route change does not fire.

Any idea what I’m doing wrong?

@eben_roux were you able to figure this out? If not, can you provide a JSBin? That will make it much easier to take a look.

Hi Kevin,

I actually did update the post :slight_smile: — turned out the full method had an error.


Oh, ok. I misunderstood that. Glad it’s working now!