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
7
votes
2 answers

Module 'ngRoute' is not available

I have linked the script in my index.html, and referenced it in app.js, but I keep getting the error that ngRoute is not available. Any help would be greatly appreciated! app.js angular.module('gameMaster', ['ngRoute',…
7
votes
5 answers

How do I replace my angular location without a controller refresh?

Suppose I have an Angular app for editing eCards. Creating a new eCard uses a path like #/ecard/create and editing an existing eCard uses a path like #/ecard/:id. A tabbing system lets us have multiple eCards open for editing at a time. We'd like…
Eli Courtwright
  • 186,300
  • 67
  • 213
  • 256
7
votes
1 answer

How to call a function in AngularJs when route matches?

$routeProvider.when('/ticket', { controller: TicketController, templateUrl: Routing.generate('ticket_list') }); displays a simple list where each entry is selectable. However on select no extra view is loaded. Every thing is in ticket_lost…
DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
7
votes
4 answers

Toggle visibility of a ng-include depending on route

I have the following configuration: $routeProvider .when('/cars', { templateUrl: 'app/cars/index.html', controller: 'CarsCtrl', reloadOnSearch: false }) .when('/bikes', { templateUrl: 'app/bikes/index.html', controller: 'BikesCtrl', reloadOnSearch:…
luisfarzati
  • 8,649
  • 6
  • 29
  • 27
6
votes
1 answer

AngularJS Codeigniter base_url path settings

I am creating a website with Codeigniter 3 and AngularJs. While delevolping i have faced some issues with base url in codeigniter. Im attaching an image file of my directory struture. In my mainpage(views/home.php) i put a ng-view for loading…
Raj
  • 879
  • 1
  • 10
  • 23
6
votes
2 answers

How to navigate one page to another page using AngularJs

How to navigate from one page to another page. Assume i have a login page, after entering username and password fileds while click on submit button it needs to validate and if both username and password is correct it needs to go home page. Home page…
Ranga Reddy
  • 2,936
  • 4
  • 29
  • 41
6
votes
3 answers

Angular 1.4.5 : Uncaught Error: [$injector:modulerr] ngRoute

When I try to refresh the page I have this error : angular.js:38 http://errors.angularjs.org/1.4.5/$injector/modulerr? p0=myApp&p1=Error%3A%2…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.5%2Fangular.min.js%3A19%3A381) I have a simple module…
Nacim Idjakirene
  • 1,882
  • 8
  • 26
  • 45
6
votes
1 answer

How to setup AngularJS $locationProvider HTML5 mode for non-root base urls?

I have a working AngularJS (1.3.8) application, which is deployed as a web app in Tomcat under an application context 'app'. URLs look like this: https://www.myserver.com/app/#/login https://www.myserver.com/app/#/register etc. Routes are defined…
OliverM
  • 510
  • 6
  • 13
6
votes
1 answer

Angular $routeProvider and Controller As Syntax

Can anyone tell me if it is valid to use $routeProvider with Controller as syntax? I am having issues accessing

{{kickController.foo}}

from the controller where this.foo resides. angular.module('ucp.kick',…
dman
  • 10,406
  • 18
  • 102
  • 201
6
votes
1 answer

Merge url of angular and Django

What is the standard way to define urls when using Django,AngularJS and Django-Rest-Framework ? In other way, is it possible to define SPA urls commonly instead of defining it in both Angular and Django ?
6
votes
2 answers

Ways of loading data into controller via service in AngularJS

I have a service that loads data using $http and returns a promise (simplified for brevity): angular.module('myApp').factory('DataService', ['$http', function($http) { function unwrapFriendList(data) { ... return unwrappedFriendList; } …
pbkhrv
  • 647
  • 4
  • 11
6
votes
1 answer

How to structure AngularJS and PaperJS project

The idea is to make use of Angular in a simple canvas game development. In theory the project should benefit from being more systematic, manageable and scalable. This is not a sprite/tile/collision game and PaperJS is used to do most canvas drawing…
Jason
  • 163
  • 2
  • 3
  • 7
6
votes
1 answer

Can I pass multiple controllers in $routeProvider.when() in angularJS?

I tried searching for this on various threads, but I can't conclusively understand this. test.config(['$routeProvider', function($routeProvider){ $routeProvider .when('/', { controller:'SimpleController1', …
Kshitij
  • 639
  • 1
  • 10
  • 25
6
votes
4 answers

AngularJS AppCtrl wait for HTTP event to success

I'm all new to AngularJS and need some help, I have a "AppCtrl" and from there I have a HTTP webservice call - and need the webservice call response accessible in my other controllers. angular.module('starter.controllers',…
pkdkk
  • 3,905
  • 8
  • 44
  • 69
6
votes
2 answers

Blank page using multiple views with UI-Router

I followed this article and this other I've tried to replicate what's on the wiki, without any luck. So far this is what I've done the folder structure: partial index index.html // inner view index.css index.js…
pedrommuller
  • 15,741
  • 10
  • 76
  • 126