$routeProvider
is a service of module ngRoute
that has a simple API, accepting either the when()
method which takes a path and hash of options including the templatePath
and controller
, which matches a pattern and otherwise()
method which allows us to redirect to a route if one is not found.
Questions tagged [route-provider]
299 questions
0
votes
1 answer
AngularJS directive vs routeProvider
I have a problem with my directive. Actually my routeProvider is not being fired when the $location changes my url path.
Here is my code:
var appPath = location.pathname;
var bdaApp = angular.module('bdaApp', ['ui.bootstrap', 'ngResource',…

Thiago Pereira
- 1,724
- 1
- 17
- 31
0
votes
1 answer
controller not found through routeProvider
$routeProvider
.when('/default', {
templateUrl: 'HTML/login.html',
controller : 'funct2'
}).when('/adminMenu/:username', {
templateUrl: 'HTML/adminMenu.html',
…

user2786754
- 139
- 4
- 12
0
votes
1 answer
AngularJS - Changing a query param term within $routeProvider?
I am creating a navigation, where when on the active 'link', a feed loads but with a different searched term.
Basically, the all the links are the same, the only difference is the term set in the .factory parameter.
Since everything is the same…

Roc
- 121
- 1
- 1
- 16
0
votes
1 answer
AngularJS $stateProvider shorthand
Is there a shorter version for this piece of code?
I am using ui-router.js as well. The code is only an excerpt of my menu.
function ($stateProvider, $routeProvider, $urlRouterProvider) {
var home = {
name: 'home',
…
0
votes
1 answer
RESTful route angular route provider
I would like to do something like this:
$routeProvider
.when '/playlists/:playlistId',
templateUrl: '/partials/playlists/show.html'
.when '/playlists/new',
templateUrl: '/partials/playlists/new.html'
unfortunately, angular seems…

bsiddiqui
- 1,886
- 5
- 25
- 35
0
votes
1 answer
$routeProvider: Undefined number of IDs
in my angularjs app my path gets build like so:
When the user clicks a submenu item the index of the item is added to the path. The depth of the menu is not specified.
So if the user clicks though all the menus the path could look like…

Alexander Scholz
- 2,100
- 1
- 20
- 35
-1
votes
2 answers
Angular 1.4 - reuse same controller in $routeProvider
I am trying to use same controller on both full and mobile views using $routeProvider. Code below does not work out of the box. What am i missing?
Also i could use another idea - same controller, but different templateUrl based on user agent. Can i…

Lev Savranskiy
- 422
- 2
- 7
- 19
-1
votes
1 answer
Why aren't I getting a 404 with an unhandled state?
I am using $stateProvider to set-up my states like so:
constructor($stateProvider, $urlRouterProvider, $locationProvider) {
$stateProvider.
state("something", {
url: "/index.html"
})
// many more
}
I am not…

Yatrix
- 13,361
- 16
- 48
- 78
-1
votes
1 answer
AngularJS routeProvider not working
EDIT: Solved the problem, seems the '#' character that Angular uses caused the problem. Here are the correct.
Edit after WiRo's answer
(I use grunt for my http-server)
app.js…

Jelmer
- 949
- 3
- 10
- 23
-1
votes
1 answer
Use base domain name with $routeProvider
I am using $routeProvider with an angular app so I have a configuration like so:
$routeProvider
.when '/compilations',
templateUrl: 'angular/templates/player_compilation.html'
controller: 'compilationController'
.when '/news',
…

laertiades
- 1,992
- 2
- 19
- 26
-1
votes
1 answer
AngularJS: Config $routeProvider after $http request
I need to config $routeProvider after ajax request, but i can not using $http in config, means following code causes error:
module.config(['$routeProvider','$http',function ($routeProvider,$http) {}
and $routeProvider can not accessed in…

Nik Kashi
- 4,447
- 3
- 40
- 63
-1
votes
1 answer
AngularJS RouteProvider and ExpressJS sendfile
In my Angular app, I'm trying to render partials that load into the index page when a user clicks a link. It worked fine before with the following code:
//app.js in Angular
angular.module('myApp', [
'ngSanitize',
'ngRoute',
…

user2669464
- 969
- 3
- 12
- 17
-2
votes
1 answer
Calling angular template in quick succession twice
I would like to know if loading a template URL in quick succession twice can cause a template load error because the second load is expecting the template in the template cache ( since there's already a first load that's not complete ).
I am seeing…

Sirish Chandraa
- 53
- 2
- 7
-2
votes
1 answer
$routeprovider not working is not working as expected?
here is my code for route provider
var externalapp = angular.module('Example', [ ]);
externalapp.config([ '$routeProvider', function($routeProvider) {
$routeProvider
.when('/name', {
templateUrl : 'views.html',
…

anshul
- 33
- 7