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
9
votes
2 answers

Can we use ngRoute and ui.router together in angularJS app.js?

Previously, I was using ngRoute in my main controller. I have to create child view functionality and it is only achieved by UI-Router. please suggest?
Harsh Bhalodia
  • 153
  • 1
  • 2
  • 9
9
votes
1 answer

AngularJS $routeParams vs $stateParams

What is the difference between: $routeParams and $stateParams and when to use what?
David Dury
  • 5,537
  • 12
  • 56
  • 94
9
votes
1 answer

Multiple query string parameters in angularjs

I'm struggling with passing and reading multiple query string parameters in a route. $routeProvider.when("/joboffers:keywords:location", { controller: "jobOffersController", templateUrl: "/App/Views/JobOffer/All.html" }); This is the search…
laszlokiss88
  • 4,001
  • 3
  • 20
  • 26
9
votes
6 answers

AngularJS and Laravel 4 routing conflict in HTML5 mode

I would like to remove the # hash from URLs using Angularjs' $locationProvider.html5Mode(true). Example: The address bar displays http://localhost/shop instead of http://localhost/#/shop. Everything works well untill I refresh a page. If i…
user1894374
  • 233
  • 3
  • 19
9
votes
3 answers

angularjs $routeProvider route is executed before resolve completes

I would like the route.resolve method(s) to fire before the actual route code is run. Unfortunately in the code below, prime() gets called but it is called asynchronously and the route code gets called before the prime completes. I thought the…
relaxDude
  • 101
  • 5
9
votes
2 answers

during ng-animate of views, "leaving" view still takes up space while "entering" view is animating in

I'm using AngularJS 1.1.5 and trying out the ng-animate directive with daneden's animate.css. I have a couple of views set up using routing. I'm using Twitter Bootstrap 3 RC1. Here is the code for the ng-view:
OJ Raqueño
  • 4,471
  • 2
  • 17
  • 30
9
votes
3 answers

How can I easily implement multiple layouts in Angular JS?

I need to be able to specify different layouts for different routes, and most preferably I would like to be able to define layouts and other parameters in an object in route config and have them propagate on route change.
Kenneth Lynne
  • 15,461
  • 12
  • 63
  • 79
9
votes
1 answer

Opposite of $routeChangeSuccess in AngularJS

I was just wondering if there is a way to know if someone is changing the route of the URL. As an example, I have something like this in my html: To somewhere and I was using this: $scope.$on('$routeChangeSuccess',…
Tomarto
  • 2,755
  • 6
  • 27
  • 37
8
votes
1 answer

AngularJS: Getting ngRoute working

I'm working on a new Angularjs webapp where I have to use ngRoute. I'm a bit confused first, because routing doesn't work at all in my case – I always end up at index and MainCtrl. in index.html I've included all dependencies like so:
Ashesh
  • 2,978
  • 4
  • 27
  • 47
8
votes
4 answers

AngularJS ngRoute and PHP $_SESSION variables

I have 3 pages: index.php login.php display.php index.php Sets up AngularJS using the ngRoute module to navigate my pages. login.php Loaded by default and sets PHP $_SESSION variables. display.php Echos the contents of $_SESSION. I navigate to…
Craig
  • 2,093
  • 3
  • 28
  • 43
8
votes
4 answers

angular MINERR_ASSET not found 404

I'm getting an error logged to the console: GET http://localhost:3000/js/lib/angular/MINERR_ASSET 404 (Not Found) I saw this post and it said it was a result of not inculding ngRoute module, but I do! public/js/app.js: window.app =…
Connor Leech
  • 18,052
  • 30
  • 105
  • 150
8
votes
2 answers

prevent re initialization of controller on $location.path()

I am working on an application where I have to insert a back navigation link to the main page from details page. Controllers for both views are different. I am using $location.path('/') to navigate back to the main page. Problem is, my controller…
Dania
  • 1,007
  • 1
  • 14
  • 21
8
votes
2 answers

Angularjs routing with django's urls

I am using AngularJS for my front-end and Django as a back-end. I am doing very simple things at the back-end so I have not considered using tastypie. The problem where I am stuck is the client/server routing. I am thoroughly confused. What I do…
Deepankar Bajpeyi
  • 5,661
  • 11
  • 44
  • 64
8
votes
2 answers

Return interdependent async promises in $routeProvider resolve

Consider the code: var myApp = angular.module('myApp', []); The routes: myApp.config(['$routeProvider', function($routeProvider) { $routeProvider.when('/', { templateUrl: 'app.html', controller:myAppController, …
AlwaysALearner
  • 43,759
  • 9
  • 96
  • 78
8
votes
3 answers

How to use current url params in angular controller

I have a dynamic value params in url and I want to get it and use in controller when onload But I have no idea how to deal with $route.current.params Let say I have this route provider $routeProvider.when('foo/:bar', {templateUrl:…
vzhen
  • 11,137
  • 13
  • 56
  • 87