Questions tagged [angularjs-routing]

Use for ngRoute, the built-in routing module in AngularJS, which can map the browser URL to a defined route.

Is used for deep-linking URLs to controllers and views (HTML partials).
It watches $location.url() and tries to map the path to an existing route definition.

Routes can be defined through the $routeProvider API. The $route service is typically used in conjunction with ngView directive and the $routeParams service.

See:

Related tags

1283 questions
36
votes
5 answers

how to pass querystring in angular routes?

I am working with AngularJS routes, and am trying to see how to work with query strings (for example, url.com?key=value). Angular doesn't understand the route which contains key-value pair for the same name albums: angular.module('myApp',…
Amb
  • 3,343
  • 7
  • 27
  • 34
35
votes
2 answers

AngularJS redirect without pushing a history state

I'm working on an AngularJS app that has a catch all route (eg, .when('/:slug', {...)) which is necessary to support legacy url formats from a previous (non-angular) version of the app. The controller that responds to the catch all tries pulling a…
kyleder
  • 667
  • 1
  • 7
  • 18
32
votes
2 answers

Angular UI-Router: child using parent's view

In story form: What I am looking for here is a master-detail setup. The master is in list form and when I click on a link (relative to a particular row/record (or Account in this case)) I want to see the details in the main view (literally, the…
Honus Wagner
  • 2,830
  • 13
  • 44
  • 61
31
votes
1 answer

Angularjs Nested states: 3 level

I am using Agnularjs and Ionic Framework. I am trying to achieve a nested states, which looks like below, Eventmenu(root)   Home (2 level)     Home 1 (3 level)     Home 2   checkin   attendee My routes file looks like, angular.module('ionicApp',…
Liam
  • 415
  • 1
  • 6
  • 11
29
votes
4 answers

How to persist optional state parameter on browser back in ui-router?

I'm having one parent state that has two children's state inside that I'm going to show one state based on the URL. Out of those two states one is having to parameters like param1 and param2, I have use params option of ui-router inside state…
29
votes
4 answers

AngularJS UI Router $state reload child state only

I am using UI router for tabs of a main menu as well as for links within one of the states (users). The users state has a list of users and when a user is clicked, I want to reload the child state only, but it is reloading both the child state and…
dfstewart3
  • 303
  • 1
  • 3
  • 6
28
votes
3 answers

scope and controller instantiation with ui router

I am confused about when controllers get instantiated. Also, how do controllers gets instantiated when nesting states. I might be confused how scope gets attached to view and controller, that is, if every view gets its own controller and scope or do…
Shoebie
  • 1,263
  • 2
  • 12
  • 24
28
votes
2 answers

.config, .run, AppCtrl - where to put routes?

I wanted to find out the difference between the .config and .run functions in AngularJS. I was using my .config for setting up routes, but I did have some $on's for watching route change start and success events. I then moved some of this code to…
Martin
  • 23,844
  • 55
  • 201
  • 327
26
votes
5 answers

How would I have ui-router go to an external link, such as google.com?

For example: $stateProvider .state('external', { url: 'http://www.google.com', }) url assumes that this is an internal state. I want it to be like href or something to that effect. I have a navigation…
22
votes
4 answers

How do I parse URL params after a hash with Angularjs?

I'm trying to parse for the access_token from Foursquare where the URL is like this: https://mywebsite.com/4sqredirect/#access_token=1234567890XXXXX I've tried $routeParams and $location and get nothing returned. Only after I tried $route, I did…
padawanlvn
  • 399
  • 1
  • 4
  • 12
22
votes
3 answers

AngularJS Uncaught ReferenceError: controller is not defined from module

I have the following code; var app = angular. module("myApp",[]). config(function($routeProvider, $locationProvider) { $routeProvider.when('/someplace', { templateUrl: 'sometemplate.html', …
Joshua Wooward
  • 1,508
  • 2
  • 10
  • 12
21
votes
1 answer

Debug route provided to routeProvider

I am new to AngularJS and am attempting to debug some of my routes but I don't know how to display/view the route passed to the routeprovider. For example if my current routing is set up as follows; reportFormsApp.config(function ($routeProvider) { …
Ray Brack
  • 293
  • 1
  • 2
  • 8
21
votes
2 answers

AngularJS - use routeProvider "when" variables to construct templateUrl name?

So this is what I am trying to accomplish: 'use strict'; var app = angular.module('myModule', ['ngRoute']); app.config(function($routeProvider) { $routeProvider .when('/', { redirectTo: '/pages' }) .when('/pages/:pageName', { …
Georgi Angelov
  • 4,338
  • 12
  • 67
  • 96
20
votes
1 answer

AngularJs routeProvider http status 403

I'm doing authentication and authorization in the server side. In angularJs I'm doing the routing using the routeProvider like this. $routeProvider. when('/', { templateUrl: 'partials/_home', controller: 'HomeCtrl' …
20
votes
3 answers

Using resolve in $routeProvider causes 'Unknown provider ...'

I am trying to do an asynchronous http request to load some data before my app loads and so I am using a resolve in $routeProvider which is an http request in my MainController. For some reason, I keep getting Error: [$injector:unpr] Unknown…
Georgi Angelov
  • 4,338
  • 12
  • 67
  • 96
1
2
3
85 86