Nativescript-angular: Support the new router

Created on 6 May 2016  路  9Comments  路  Source: NativeScript/nativescript-angular

I figured this is one of those things we haven鈥檛 gotten around to quite yet, but I thought I鈥檇 create an issue to track this.

@NathanWalker and I gave it a shot real quick the code below.

import {Component} from "@angular/core";
import {HTTP_PROVIDERS} from "@angular/http";
import {Routes, ROUTER_PROVIDERS} from "@angular/router";
import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from "nativescript-angular/router";
import {LoginPage} from "./pages/login/login.component";
import {ListPage} from "./pages/list/list.component";

@Component({
  selector: "main",
  directives: [NS_ROUTER_DIRECTIVES],
  providers: [HTTP_PROVIDERS, NS_ROUTER_PROVIDERS, ROUTER_PROVIDERS],
  template: "<page-router-outlet></page-router-outlet>"
})
@Routes([
  { path: "/Login", component: LoginPage },
  { path: "/List", component: ListPage }
])
export class AppComponent {}

But I get the error below:

May  6 15:52:50 107-1-111-1-ip-static sampleGroceries[6589]: CONSOLE ERROR file:///app/tns_modules/zone.js/dist/zone-node.js:421:23: Error: Uncaught (in promise): EXCEPTION: Error in :0:0
    ORIGINAL EXCEPTION: not implemented
    ERROR CONTEXT:
    [object Object]

I鈥檓 guessing because we don鈥檛 support the new router quite yet.

Thanks 馃榾

feature

Most helpful comment

@NathanWalker On the call withAngular team last week, Tobias waned us that they are preparing to land another big chunk of refactoring (a.k.a. breaking changes) on the router and suggested that we wait for it before starting to integrate. That's why we put this task temporary on hold.

All 9 comments

@vakrilov @hdeshev Just wanted to follow up on the status of this?
As always anything I can help with on a branch to finish it up, may be at a standstill at moment? https://github.com/NativeScript/nativescript-angular/tree/new-router

@NathanWalker On the call withAngular team last week, Tobias waned us that they are preparing to land another big chunk of refactoring (a.k.a. breaking changes) on the router and suggested that we wait for it before starting to integrate. That's why we put this task temporary on hold.

It seems Angular router has changed a lot, but it gets stablized now.

http://victorsavkin.com/post/145672529346/angular-router

@vakrilov Any news about the router v.3 implementation ?

@LTMenezes it's implemented in the latest 0.2.0 release. You can reference this excellent example: https://github.com/NativeScript/nativescript-angular/blob/master/ng-sample/app/examples/router/page-router-outlet-nested-test.ts

@NathanWalker Is it possible to use different transitions now ? In the previous router (which is deprecated atm) we were not able because "There is little value in implementing support for this with the current router-deprecated package. We'll add this feature when we integrate the new router."
https://github.com/NativeScript/nativescript-angular/issues/202

What's the status of the following:

  • Clear history.
  • replaceState/Navigate without history
  • Page transitions/animations

I see there are some examples of animation examples here https://github.com/NativeScript/nativescript-angular/tree/master/ng-sample/app/examples/animation, but can it be used for pages?

@m-abs Espeically the page transition thing.. I cannot let all of my pages to have same transition lol so its unusable..

Both page transitions and clearHistory are currently in progress. They will probably land in master (and in the @next respectively) sometime this week.

Was this page helpful?
0 / 5 - 0 ratings