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

locationChangeStart and preventing route change

I'm trying to create basic validation whether user can access some route or not. I had progress in that, but there's one thing that I can't figure out. I'm using $locationChangeStart to monitor route changes. Scenario is: 1. if user is logged in,…
6
votes
3 answers

AngularJS (Restangular): Making a promise block? Need to use it for validating a token

I have stumbled upon Restangular for making calls to a rest service. It works great and returns a promise. I need to be able to have the call block. The reason for this is on a fresh page reload I am technically not loggged in but I may have a token…
Martin
  • 23,844
  • 55
  • 201
  • 327
6
votes
3 answers

AngularJS show dialog from routeProvider

Is it possible to [execute a function] e.g. open a modal dialog window from the routeProvider when a certain route is requested? myApp.config(function($routeProvider) { $routeProvider .when('/home', { …
Tawani
  • 11,067
  • 20
  • 82
  • 106
6
votes
1 answer

AngularJS: service query returning zero result

my app.js looks like var app = angular.module('pennytracker', [ '$strap.directives', 'ngCookies', 'categoryServices' ]); app.config(function($routeProvider) { console.log('configuring routes'); $routeProvider .when('/summary', {…
6
votes
1 answer

Back button with nested states in Angular Router

I have an AngularJS application that makes use of the new, state-based ui-router. I have three different views in my application, where one is a top-level views, and the other two are nested ones. The structure basically is as follows: / =>…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
5
votes
4 answers

$scope not working in my nav bar controller?

My Angular app is developed using a boilerplate of this yeoman generator. Routing and all things working fine but I could not get to working $scope only on navbar-controller.js and footer-controller.js. Please tell me if you need more information to…
5
votes
1 answer

ios address bar triggered when angular ui router state changes

I am using Angular UI Router. Whenever I click on a link with ui-sref the address bar from ios mobile browser shows up. For example when I scroll down, the address bar hides and if I click on a link and the page transition finishes the ui address…
5
votes
3 answers

How to do $state.go() with params?

I have perfectly initialized $stateProvider and I'm using all this states with ui-sref. Works great. User presses the button and thorugh the $stateProvider goes to the edit page. On this page I have a form which does $http request: this.pushData…
5
votes
1 answer

AngularJs - What exactly does $route.current contain?

According to the docs, $route.current contains controller and locals. For example, if this is one of my route: $routeProvider .when('/item1/:value', { templateUrl: 'item1.html', controller: 'Item1Controller', title:…
Shawn
  • 2,675
  • 3
  • 25
  • 48
5
votes
1 answer

$routeProvider / $locationProvider not a function in AngularJS Routing

I'm trying to create so-called 'SEO-friendly' URLs in AngularJS. In my script.js for the routing I have: app.config(['$routeProvider', function($routeProvider) { $routeProvider.html5Mode(true); when('/blog', { templateUrl:…
JWDev
  • 856
  • 1
  • 10
  • 22
5
votes
4 answers

Force reload route/state on link click

Currently I'm doing something like this link.on('click', function () { if (link.attr('href') !== $route.current.originalPath) return; $route.reload(); }); I'm not aware of side effects but I guess there can be some. Is there more…
5
votes
1 answer

Keep Checkbox Checked After Navigating Bewteen Partials

I'm building a single page fantasy football application which has partial pages for each position and displays a list of players. I want to implement a checkbox next to each player and as players get drafted I can check the checkbox and have a line…
NevrMore
  • 203
  • 2
  • 11
5
votes
2 answers

Render initial Angular ng-view on server-side and take it from there

I want to avoid the latency in display of initial JavaScript-rendered views. I want the user to see content immediately and have Angular take it from there. I do not want to just replace this ng-view when Angular ngRoute kicks in as a blink will…
5
votes
1 answer

AngularJS HTML5 mode does a full page reload on manual url change

I am using AngularJS with ui.router. I have seen a behaviour difference in Hashbang and HTML5 mode and I wonder if it can be changed/prevented. When using $locationProvider.html5Mode(true); a full page reload happens when I manually change the…
user3142446
5
votes
1 answer

angularjs error handling in ajax request

I want to write an error handling part in my application I use this code below but when error 500 occur its work right but there is a small or maybe big problem and thats the page load at first and after few second error page load , How can i remove…
m hadadi
  • 949
  • 2
  • 10
  • 22