NativeScript / nativescript-angular

Integrating NativeScript with Angular
http://docs.nativescript.org/angular/tutorial/ng-chapter-0
Apache License 2.0
1.21k stars 241 forks source link

Support the new router #218

Closed tjvantoll closed 8 years ago

tjvantoll commented 8 years ago

I figured this is one of those things we haven’t gotten around to quite yet, but I thought I’d 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’m guessing because we don’t support the new router quite yet.

Thanks 😀

NathanWalker commented 8 years ago

@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

vakrilov commented 8 years ago

@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.

HerringtonDarkholme commented 8 years ago

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

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

LTMenezes commented 8 years ago

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

NathanWalker commented 8 years ago

@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

denkomanceski commented 8 years ago

@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

m-abs commented 8 years ago

What's the status of the following:

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?

denkomanceski commented 8 years ago

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

vakrilov commented 8 years ago

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