Nativescript-angular: Angular 4 update: Behaviour of nsRouterLink has been changed slightly

Created on 28 Mar 2017  路  4Comments  路  Source: NativeScript/nativescript-angular

Please take a look at this simple routing example:

const routes: Routes = [
  {
    path: 'books',
    component: BookListComponent
  },
  {
    path: 'books/:isbn',
    component: BookDetailsComponent
  }
];

With the normal Angular 4 router I can navigate from books to books/XXX via this link:

<a [routerLink]="theNumber"></a>

(full example here, demo here, tested on both Angular2/Router3 and Angular4/Router4)

Before upgrading this worked fine for nativescript-angular, too:

<StackLayout [nsRouterLink]="theNumber"></StackLayout>

(full example here)

But after upgrading to [email protected] the router cannot match any routes. I had to change the link like this:

<StackLayout [nsRouterLink]="['books', theNumber]"></StackLayout>

(full example here)

This difference between nsRouterLink and the normal routerLink is not desired , isn't it?!

bug

All 4 comments

Great, I have seen relativeTo in the code.

Do you have an ETA for the patch on NPM?

If everything is fine, we'll release 1.5.1 tomorrow.

Fixed with 1.5.1 patch.

I can confirm this. Thanks for the super-fast fix! 馃憤

Was this page helpful?
0 / 5 - 0 ratings