mardi 21 juin 2016

Binding to dynamic route segment

I am trying to bind a computed property (or change via an observer) the iso dynamic segment in the locale route. The router I have is represented by:

this.route('locale', { path: '/:iso' }, function(){
    this.route('products', function() {
        this.route('single', { path: '/:id/:seoName' });
    });
});

Which results in URLs like this:

http://localhost:4200/en-us
http://localhost:4200/en-us/products
http://localhost:4200/en-us/products/123/product-name

What I'm wondering is if there is any way to programatically change the en-us part of the URL no matter which route you're on? My issue so far with just running a transitionTo() is that I have no way of knowing what the sub routes are from the current location.

Basically, I need a way of binding the en-us segment to a computed property I can that can update the URL automatically when it changes.

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire