Skip to main content

All Questions

1115 votes
15 answers
272k views

What is the difference between angular-route and angular-ui-router?

I'm planning to use AngularJS in my big applications. I'm in the process to find out the right modules to use. What is the difference between ngRoute (angular-route.js) and ui-router (angular-ui-...
Premchandra Singh's user avatar
382 votes
3 answers
389k views

How to pass parameters using ui-sref in ui-router to the controller

I need to pass and receive two parameters to the state I want to transit to using ui-sref of ui-router. Something like using the link below for transitioning the state to home with foo and bar ...
skip's user avatar
  • 12.7k
379 votes
10 answers
183k views

AngularJS ui-router login authentication

I am new to AngularJS, and I am a little confused of how I can use angular-"ui-router" in the following scenario: I am building a web application which consists of two sections. The first section is ...
Ahmed Hashem's user avatar
  • 4,743
178 votes
3 answers
114k views

What is the difference between $routeProvider and $stateProvider?

Please explain the difference between $routeProvider and $stateProvider in AngularJS. Which is best practice?
YYY's user avatar
  • 3,520
120 votes
6 answers
124k views

How to pass an object into a state using UI-router?

I'd like to be able to transition to a state and a pass an arbitrary object using ui-router. I'm aware that usually $stateParams is used, but I believe this value is inserted into the URL, and I don'...
eddiec's user avatar
  • 7,646
110 votes
2 answers
84k views

Difference between $state.transitionTo() and $state.go() in Angular ui-router

In AngularJS, I see sometimes we use $state.transitionTo() and sometimes we use $state.go(). Can anyone tell me how they differ and when one should be used over the other?
Barcelona's user avatar
  • 2,132
96 votes
5 answers
243k views

Using $window or $location to Redirect in AngularJS

The app I am working on contains various states (using ui-router), where some states require you to be logged in, others are publicly available. I have created a method that validly checks whether a ...
Thorbjørn Kappel Hansen's user avatar
91 votes
6 answers
93k views

Redirect a state to default substate with UI-Router in AngularJS

I'm creating a tab based page which shows some data. I'm using UI-Router in AngularJs to register states. My aim is to have one default tab open on page load. Each tab have sub tabs, and I would ...
Leo's user avatar
  • 5,793
87 votes
8 answers
148k views

How do I get the Back Button to work with an AngularJS ui-router state machine?

I have implemented an angularjs single page application using ui-router. Originally I identified each state using a distinct url however this made for unfriendly, GUID packed urls. So I have now ...
biofractal's user avatar
  • 19.2k
81 votes
3 answers
55k views

How to delete '#' sign in angular-ui-router URLs

I'm using the angular-ui-router library and I have a problem with URLs. I have the following code: app.js: app.config(function ($stateProvider, $urlRouterProvider) { $stateProvider .state('...
Niezborala's user avatar
  • 1,857
80 votes
6 answers
54k views

Angular ui router unit testing (states to urls)

I'm having some trouble unit testing the router in my application, which is built on the Angular ui router. What I want to test is whether state transitions change the URL appropriately (there will be ...
Terrence's user avatar
  • 1,022
80 votes
11 answers
54k views

(Angular-ui-router) Show loading animation during resolve process

This is a two part question: I am using the resolve property inside $stateProvider.state() to grab certain server data before loading the controller. How would I go about getting a loading animation ...
Matt Way's user avatar
  • 33.2k
77 votes
9 answers
60k views

Directing the user to a child state when they are transitioning to its parent state using UI-Router

Consider the following: .state('manager.staffList', {url:'^/staff?alpha', templateUrl: 'views/staff.list.html', data:{activeMenu: 'staff'}, controller: 'staffListCtrl'}) .state('manager.staffDetail', {...
Meeker's user avatar
  • 5,979
71 votes
5 answers
89k views

How do I share $scope data between states in angularjs ui-router?

Without using a service or constructing watchers in the parent controller, how would one give children states access to the main controller's $scope. .state("main", { controller:'...
sjt003's user avatar
  • 2,617
68 votes
6 answers
103k views

How to extract query parameters with ui-router for AngularJS?

How do I extract query parameters using ui-router for AngularJS? In AngularJS' own $location service I did: ($location.search()).uid to extract the parameter uid from a URL. What is the ...
Per Quested Aronsson's user avatar

15 30 50 per page
1
2 3 4 5
207