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
5
votes
1 answer

Undefined is not a function error when using factory method in angularJS

I'm having problems finding the solution to TypeError: undefined is not a function in my code. I have the following app.js: var app = angular.module('test', ['ngRoute', 'test.services', 'test.directives', 'test.controllers']); app.config(function…
5
votes
1 answer

How do I debug Javascript in an AngularJS partial?

I am using the Routing and Multiple Views feature of AngularJS but I don't see the HTML partial file (or the embedded Javascript) in Chrome's "Sources" tab of the Developer Tools. In my index.html file, it includes all the tags for AngularJS,…
Brent Washburne
  • 12,904
  • 4
  • 60
  • 82
5
votes
4 answers

angularjs maintain the scope variable across routes

How do I maintain the model across routes. for eg I have a list of profiles loaded onto the home page. The home page also contains a "load more" action to load more profiles, basically pushing data to the model. On clicking of a specific profile,…
5
votes
1 answer

AngularJS $routeProvider does not have reload method

The AngularJS documentation indicates that the ngRoute $routeProvider has a reload method. reload() Causes $route service to reload the current route even if $location hasn't changed. As can be seen in this screen shot, the $routeProvider does…
jedatu
  • 4,053
  • 6
  • 48
  • 60
5
votes
2 answers

Do angular views work when a site is served from the local file system?

I'm using angular to develop an application. I'm developing off my local file system, on Windows. However, when I enable angular-route.js, whenever I hit index.html with my browser, it instead goes to index.html#/C:/. My route definition…
Chris B.
  • 85,731
  • 25
  • 98
  • 139
5
votes
4 answers

$location.path doesn't change in a factory with AngularJS

My factory looks like: 'use strict'; angular.module('myApp') .factory('httpInterceptor',['$q','$location', '$rootScope', function($q, $location, $rootScope){ return { response: function(response) { if(response.success ===…
Shamoon
  • 41,293
  • 91
  • 306
  • 570
5
votes
1 answer

AngularJS: remembering state/setup of complex views with routes

In a single page application, is there a way of switching back and forth to an AngularJS route and to display it back in the same state as it was shown before? Usually this would be implemented by binding data in a parent scope. While this is easy…
Derek
  • 3,295
  • 3
  • 24
  • 31
5
votes
1 answer

method overloading \ overriding in AngularJS

I have a scenario, i which I have a share button, I have a container controller, called metaCtrl, which is on the html tag. And also inner controllers. I have a share button, that calls the model.share() function on…
Oleg Belousov
  • 9,981
  • 14
  • 72
  • 127
5
votes
3 answers

Why is AngularJS duplicating the query string in my route?

I am using hash-based navigation in my AngularJS app rooted at /. If a user navigates to my app like this: http://example.com/?foo A moment after the page loads, something (possibly Angular) is causing the address bar to look different than I…
djsmith
  • 3,007
  • 3
  • 24
  • 21
5
votes
1 answer

AngularJS routing for Kendo UI mobile

I'm starting to develop mobile application with Kendo UI mobile, AngularJS, PhoneGap. It would be nice to use Angular routing stuff. But Kendo UI mobile has its own routing system. Are any approaches to use AngularJS routing system instead of Kendo…
Gkr
  • 51
  • 2
5
votes
3 answers

Simple Angular $routeProvider resolve test. What is wrong with this code?

I have created a simple Angular JS $routeProvider resolve test application. It gives the following error: Error: Unknown provider: dataProvider <- data I would appreciate it if someone could identify where I have gone wrong. index.html
5
votes
4 answers

Dynamic Routing in AngularJS - Can I retrieve data from server before setting up $routeProvider?

Is there any way to make a server hit to retrieve data before setting up all the routes on the $routeProvider? I want to be able to dynamically setup routes based on this remote data. I tried something like…
dnc253
  • 39,967
  • 41
  • 141
  • 157
4
votes
0 answers

How to handle Location bad-path & redirect to default state

I have state with multiple params. Like below $urlRouterProvider.otherwise(function ($injector, $location) { var $state = $injector.get('$state'); return $state.go('404'); }); $stateProvider // Home .state('dashboard', { …
4
votes
0 answers

angular template cache doesn't work when template key contains file extension

Template cache fails for me for some reason, when I do this: angular.module('myApp').run([ '$templateCache', function ($templateCache) { $templateCache.put('test.html', 'content'); } ]); and then when using…
4
votes
0 answers

Error loading hubs. Ensure your hubs reference is correct, e.g.

There are two pages: Login.aspx and Profile.aspx, which are built using HTML and AngularJS. The login.aspx page uses ng-view to get the template of Login-view or Signup View. The code used is:
Krisalay
  • 75
  • 3
  • 9