Questions tagged [angular-new-router]

A new router for Angular 1.5 and 2.0, written with TypeScript. Deprecated / Defunct / Non-working.

A new router for Angular 1.5 and 2.0, written with TypeScript. Deprecated / Defunct / Non-working.

https://github.com/angular/router

If you are interested in the recommended component router, please look in the Angular 2 repository at https://github.com/angular/angular/tree/2.4.x/modules/%40angular/router

33 questions
16
votes
1 answer

Angular 2's equivalent to window.location.href?

How can one navigate to a different URL within Angular 2? I know that we can use JavaScript's window.location.href = '...'; But that seems wrong and would cause a page refresh. I am pretty sure that there should be functionality in Angular 2 that…
Zorthgo
  • 2,857
  • 6
  • 25
  • 37
16
votes
4 answers

Angular new router - Nested components and routing

I'm playing around with the new angular router and wanted to try out a use case where I have a component and a nested component. Below there's the JavaScript code I wrote to define the two components and the routes: angular.module('app',…
Alain
  • 881
  • 8
  • 14
14
votes
2 answers

Angular 1.5 and new Component Router

I'm using angular 1.5 beta 2 and the new router from Angular 2 alpha 45. I couldn't find examples of usage for the latest router with Angular 1. I can find examples of the usage of the router for Angular 2, using @RouteConfig. Can someone explain…
pauloya
  • 2,535
  • 3
  • 30
  • 50
8
votes
2 answers

Angular 2 - equivalent to router resolve data for new router

I am playing with Angular 2.0's new router and I try to use something similar to Angular 1.X ui-router / ng-route resolve mechanism. I was trying to achieve this using RouteData: import {Component, ViewEncapsulation} from 'angular2/core'; import { …
Yaniv Efraim
  • 6,633
  • 7
  • 53
  • 96
5
votes
1 answer

How to inject component router in Angular 1.5?

I'm working with Angular 1.5 and trying to migrate from using ui-router in 1.4 to the new Component Router in 1.5. However, when I update to 1.5, I don't see a way to inject '$router' into my configuration. I know I can download angular_1_router.js…
James Gentes
  • 7,528
  • 7
  • 44
  • 64
5
votes
3 answers

Best Practice with AngularJS template locations in Symfony 2 with the new Angular Router?

I am developing an AngularJS 1.4 Application within a Symfony2 Bundle. Symfony provides the "backend" (API) and Angular the frontend (of course). I am using the new router and stick to the components driven folder approach suggested by several…
Daniel
  • 6,916
  • 2
  • 36
  • 47
4
votes
3 answers

How can we watch expressions inside a controller in angular 1.4 using angular-new-router

Since we cannot inject $scope inside controllers in Angular 1.4+, how can we watch expressions the way we used to do with $scope.$watch? An attempt to inject $scope can be seen here ("Could not instantiate controller" error), and tutorials tells us…
zVictor
  • 3,610
  • 3
  • 41
  • 56
3
votes
1 answer

Is angular new router part of 1.5 release

Is angular new router part of 1.5 release? I can't find a clear answer but maybe I'm missing something obvious.
yar1
  • 1,331
  • 2
  • 15
  • 26
3
votes
5 answers

?How to add new router dependencies to Angular2 project

I've followed the starter app at: 'Learn in 5 mins' from https://angular.io/. I want to start trying to use the 'new' router, but when I do a: import {...} from 'angular2/router'; I get a: error TS2307: Cannot find external module…
ftravers
  • 3,809
  • 3
  • 37
  • 38
2
votes
1 answer

How to deal with extra hash in route? (AngularJS 1.5 + new/component router)

We're attempting to build an app using Angular 1.5 with the new component router bits. We've run into a bit of an edge case and we're wondering if there's any way around it. The Key Players IdentityServer v2: our client uses this for OAuth…
2
votes
0 answers

Angular New Router is now ngComponentRouter. What's the equivilant for $componentLoaderProvider

Does anyone know the new ngComponentRouter equivilant for $componentLoaderProvider to tell the router where to find the views. I have a home component located off the root of the application in app/components/home/home.html along with the…
DRobertE
  • 3,478
  • 3
  • 26
  • 43
2
votes
1 answer

How do I use router-link to point to a route that looks like this '/users/:id/messages'?

On all of the examples that I see for the new component router the ID is always at the end of the route like this: @RouteConfig([ {path: '/email/:id', component: email, as: 'email'}, ]) Which you would need a router-link like this to access…
Zorthgo
  • 2,857
  • 6
  • 25
  • 37
2
votes
1 answer

Angular 2 Component Router

I am going crazy trying to setup a simple test app on Angular 2. I have 3 pages/components that I want to load with the new Component Router. I've gotten it to semi work. Currently I have two problems... 1 - If you type the path of the component…
Zorthgo
  • 2,857
  • 6
  • 25
  • 37
2
votes
2 answers

Why is AppController.$routeConfig undefined?

I'm trying to follow this tutorial: https://angular.github.io/router/getting-started Why is AppController.$routeConfig undefined? angular.module('app', ['ngNewRouter', 'app.home']) .controller('AppController', ['$router',…
SuperUberDuper
  • 9,242
  • 9
  • 39
  • 72
2
votes
1 answer

Why can't I pass $scope and $router in controller params?

(function() { function AppController($router) { $router.config([ {path: '/courses',component: 'courses'}, {path: '/',component: 'welcome'} ]); } angular.module('MainApp', ['ngNewRouter']) …
ReeMan
  • 23
  • 3
1
2 3