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
12
votes
4 answers

How to create a 'url_for' link helper in AngularjJS

In .NET MVC there is @Url.Action() and in RoR there is url_for() I could not find similar url building helper in angularjs. I'm already providing everything that is needed to build url to $routeProvider so something like:…
Andrej Slivko
  • 1,236
  • 2
  • 12
  • 27
11
votes
1 answer

Implementing Dynamic Routing in Angular2 (Typescript)

RouteConfig class which can be used to decorate a component (@RouteConfig) with routing capabilities has certain route definitions defined for that component. Now, the catch is to have these route definitions injected at runtime (dynamically). The…
11
votes
4 answers

Angular JS $locationChangeStart get next url route object

I am trying to implement Authorization on my angular application, when a route is changed I want to check whether the route is authorized for user or not. I tried with $routeChangeStart but it does not prevents the event. My current…
Niraj Chauhan
  • 7,677
  • 12
  • 46
  • 78
10
votes
4 answers

angularjs Error: [$compile:tpload] Failed to load template

I am trying to build simple routing app in angularjs. I have main index.html page with ng-view div and javascript code for routing. Also 2 simple html pages view2.html and view3.html placed in sub folder partials1. I am getting below error. Please…
Santo
  • 362
  • 1
  • 4
  • 18
10
votes
1 answer

Angular route not working when used with Google App Engine and Flask

What I'm trying to do: I am trying to build a RESTful Flask application on Google App Engine with Angular handling the routing and view logic while Flask handles back end logic and resources. The Problem: When I start the development server for…
vicg
  • 1,280
  • 14
  • 32
10
votes
1 answer

how to redirect $routeProvider.otherwise() keeping the given query parameters

Let say I go to /unknown-route?a=hello&b=world and $routeProvider doesnt recognize it and redirect to the otherwise route: otherwise({ redirectTo: '/default-route' }); Is it possible to pass the given parameters to the redirected route. Here it…
Jordane
  • 624
  • 1
  • 7
  • 23
10
votes
4 answers

Angular's "controllerAs" not working in routeProvider

I am trying to use the controllerAs property on a $routeProvider route without any success. Here is the sample code: var app = angular.module('app', ['ngRoute']); app.config(['$routeProvider', '$locationProvider', function($routeProvider) { …
thanpolas
  • 848
  • 1
  • 8
  • 20
10
votes
2 answers

AngularJS and PhoneGap: $location.path causes subsequent tempateUrl lookup to fail

I'm having trouble getting path lookup to work with a AngularJS v1.2.0 and PhoneGap/Cordova Android application. I've come pretty far with html5mode(true) by setting in index.html and then changing $routeProvider.when('/') to…
ttiurani
  • 405
  • 3
  • 14
10
votes
3 answers

Cross origin requests are only supported for HTTP

I'm trying run this code: Exemple 06
Luciano Borges
  • 817
  • 3
  • 12
  • 31
10
votes
1 answer

ui-router Why parent states must be abstract

Why parent views have to be abstract in order to have child views (nested views) rendered? $stateProvider .state('A', {url: '/A', abstract: true, templateUrl: 'views/A.html'}) .state('A.B', {url: '', abstract: true,…
Mihai H
  • 3,291
  • 4
  • 25
  • 34
10
votes
2 answers

Angular - different route, same template/controller,different loading method

I want to use routes, but I always want to use same template & controller. I have routes like this: **a/:albumid** and **i/:imageid** In the first case I want to load an array of images and add them to a list. In the second case I want to load a…
ewooycom
  • 2,651
  • 5
  • 30
  • 52
9
votes
1 answer

anchor href linking with angular routes

I use angular routing between multiple views and try to populate a common breadcrumb list on each route change. This works fine except that the hyperlinks in the breadcrumb don't work. Essentially I have a site with the following…
jola
  • 977
  • 2
  • 10
  • 31
9
votes
3 answers

URL from $routeChangeStart route params in angularjs routes

How would it be possible to get the URL hash fragment from route params in $routeChangeStart. $scope.$on('$routeChangeStart', function (event, next, current) { // trying to get the url hash fragment from param here // e.g.…
dasboe
  • 275
  • 1
  • 2
  • 13
9
votes
3 answers

AngularJS UI-Router event when changing route

Using ngRoute once can hook up in event: $routeChangeStart and do different actions ... app.run(function ($rootScope, $location) { $rootScope.$on("$routeChangeStart", function (event, next, current) { ................ Is it possible to…
David Dury
  • 5,537
  • 12
  • 56
  • 94
9
votes
4 answers

Ionic - Reload and display new data in ng-repeat when clicking back button

Background I have an ng-repeat list that goes to a details page (which has a back button). The $scope.items variable is loaded from a get request that occurs when the page is first loaded, with my refreshItems() function. The Problem When you click…
Chad
  • 1,531
  • 3
  • 20
  • 46