FAQ Database Discussion Community


id not captured by ngRoute

angularjs,ngresource,ngroute
I have a simple Angular routing config with a home page and some user profiles. For some reason when I navigate to /users/user_3, the controller requests the user index route, users.json, instead of users/user_3.json. This is causing the User service to complain: "Error in resource configuration for action get. Expected...

Angular $routeProvider and Controller As Syntax

angularjs,routing,angularjs-scope,angularjs-routing,ngroute
Can anyone tell me if it is valid to use $routeProvider with Controller as syntax? I am having issues accessing <h1>{{kickController.foo}}</h1> from the controller where this.foo resides. angular.module('ucp.kick', ['ngRoute']).config(function($routeProvider, APP_BASE_URL) { return $routeProvider.when(APP_BASE_URL + 'kicks', { reloadOnSearch: false, navitem: true, name: 'Kicks', templateUrl: 'kick/partials/kick.html', controller: 'kick as KickController' }); });...

Angular “Unkown Provider” - how to use a factory within routeProvider configuration?

angularjs,angularjs-service,ngroute,angularjs-provider
While playing around with Angular I try to understand better how to use factory, services, constants, routing and other core concepts. So I build a simple demo app with node, express, jade and angular. Now I would like to use a value inside the routeProvider configuration. I created a constant,...

How to switch views with routing inside a directive?

angularjs,angularjs-directive,ngroute,ng-view
While learning Angular I have implemented Ember.js email widget from their home page (it is not displayed in plunkr by some reason): http://plnkr.co/edit/OACzZbDHyNNNYM9oG5gB?p=preview Unfortunately their source code looks much cleaner and smaller than my Angular's version of it... I have implemented it creating a custom directive <art-mailbox></art-mailbox> Now I want...

Not able to send data using $state.go

angularjs,ngroute
I have this code in my angular app. So as the code says, there are multiple views being loaded and I want to pass one parameter. .state('root.moduleListing', { params: ['registerData'], views: { "main_container": { controller: 'ModuleListingController as model', templateUrl: 'misc/module-listing/module-listing.tpl.html', resolve: { registerData: ['$stateParams', function($stateParams) { return $stateParams.registerData; }] }...

Delaying template rendering for authentication check in Angular

angularjs,angularjs-routing,ngroute
Angular can cause a big security issue if you have static URL's that lead to content in conjunction with an authentication scheme. If an unregistered user visits the page, the content will flash on screen for a moment before redirecting to a safe location. I found this issue, searched extensively,...

angular route deep linking using ngRoute in apache

javascript,angularjs,ngroute
i have an angular js app and i am using it in a conventional html page have included angular route also <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular-route.js"></script> and in my module var nameApp = angular.module('mainApp', ['ngRoute']); mainApp.config(['$routeProvider','$locationProvider',function($routeProvider, $locationProvider) { console.log('config '); $routeProvider...

Angular route with sailsjs

javascript,angularjs,sails.js,ngroute
I use sailjs with angular problem is when I GET with url cate/:id/new my link is like http://localhost:1337/category/5540ba9975492b9155e03836/new how angular know my ID is? I have try ngRoute but when I console.log it return Object {} my module.js angular.module('DeviceModule', ['toastr', 'ngRoute']); my controller.js angular.module('DeviceModule').controller('DeviceController', ['$scope', '$http', 'toastr', '$routeParams', function($scope, $http,...

Error ngRoute is not available

javascript,angularjs,ngroute
there is my error in console Error: [$injector:nomod] Module 'ngRoute' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. this is my index.html header : <script src="scripts/jquery-2.0.3.min.js" type="text/javascript"></script> <script src="scripts/libs/bootstrap.min.js"></script> <script...

Passing form data between pages with angular routing

angularjs,forms,ngroute,ng-view
I want to build an app which has 2 tabs, one will have a form, and the other tab is for reviewing the data filled in the form. I have a navigation, with 2 links, which are changing a ng-view div. My problem is whenever I click on the review...

ngRoute check if route is valid

angularjs,ngroute
I am using angular-route for the routing in my app. I am generating some links, and I would like to check to make sure the link has been defined in routeProvider, and won't go to the 404 page. Is there any way using ngRoute to determine if a route will...

Changing root URL Angular UI-Router

angularjs,url,angular-ui-router,root,ngroute
I'm learning Angular by rewriting a JS web application in Angular, and I'm having some struggles with replacing ngRoute with ui-router. Although I realise that it is designed to build SPAs, I'm only rewriting a branch of pages in angular. My current understanding is that ui-routing requires you to define...

Multiple ng-views for homepage in angularjs

html,angularjs,ngroute,ng-view
Okay i am new to angular, just started working with ngRoute and ngView directives, i have come across something that is an issue for me but i suspect is only an issue due to my lack of expereince in angluar. I have the following markup(simplified) on my index.html page: <html>...

Add ngRoute to angularjs

angularjs,ngroute
I am using angularjs with yeoman. I am trying to add ngRoute to my project. I've install it with bower "angular-route": "~1.4.1", and when I try to load it in app.js I get this error angular.module('myApp', ['ngAnimate', 'ngCookies', 'ngResource', 'ui.router', 'ngSanitize', 'ngTouch','ngRoute']) Error: [$injector:modulerr] Failed to instantiate module myApp due...

angularjs i18n routing with path params

javascript,angularjs,routes,internationalization,ngroute
In one application that I'm working with, the route system need to be integrated with i18n, like the example below: $routeProvider.when('/:i18n/section', ...); But I'm facing some issues due to, what I guess it is, the $digest cycle, which doesn't change the i18n param at the runtime. Other issue that I'm...

disable'$scope.$on('$locationChangeStart' )' if user click cancel?

angularjs,ngroute,cancellation
I have problem when the user click cancel and it is true it will redirtect i it will trigger $scope.$on('$locationChangeStart') becouse of that I will have 'You have unsaved changes. If you continue your changes will be lost.' appear twice. just want to ask how can I disable'$scope.$on('$locationChangeStart' )' if...

jsPlumb is not redrawn after view change in angular.js?

javascript,angularjs,jsplumb,ngroute,ng-view
I made a two pages using angularjs ngRoute. On first page I show two connected jsPlumb objects. Second page does not contain an Plumb object. However, when I go from first page to second Plumb objects does not disappear. Do you know how to achieve proper jsPlumb refresh with ng-view...

Adding css class on $routeChangeStart doesn't trigger animation (unless in setTimeout)

javascript,angularjs,settimeout,css-animations,ngroute
I'm new to Angular, so if I'm doing any of these steps all wrong please set me straight. I am trying to get the clamps on the left and right side of my website to animate in on initial page load. Here it is in production: https://www.robotsidekick.com As you can...

AngularJS - Issue with $routeProvider and data-ng-view

javascript,html,angularjs,routes,ngroute
I have this following html pages, index.html - has ng-view welcome.html app.html - which has many child pages. So need to use ng-view My initial $routeProvider is, $routeProvider .when('/', { redirectTo: '/welcome' }) .when('/welcome',{ templateUrl: 'views/welcome.html', controller: welcomeCtrl }) .when('/app',{ templateUrl: 'app.html', controller: mainCtrl }) .otherwise({ redirectTo: '/welcome', }); Now...

ngRoute in angularjs/multiple views

angularjs-routing,ngroute
I am following a tutorial for learning angular. I am using ngRoute to marry 2 sets of views/controllers. customers.html and cutomersController and orders.html and ordersController. When index.html loads it does show customers.html as desired. But when I click on 'View Orders' link, it does not show the order details. The...

Blank screen ionic

angularjs,ionic,ngroute
When running my code I get a blank screen with console error: GET http://localhost/templates/home.html 404 (Not Found) resulting in a blank screen. The code is run into a lamp server (localhost). My index.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title> <link href="lib/ionic/css/ionic.css" rel="stylesheet"> <link...

AngularJs show Error: [$injector:modulerr] in console?

angularjs,ngresource,ngroute
HTML <!DOCTYPE html> <html ng-app="adaniapp"> <head> <link rel="stylesheet" href="css/bootstrap.min.css" /> <link rel="stylesheet" href="css/font-awesome.css" /> <link rel="stylesheet" href="css/style.css" /> </head> <body> <div id="main"> <div ng-view></div> </div> <script src="js/angular.min.js"></script> <script src="js/angular-route.js"></script> <script src="js/angular-resource.min.js"></script> <script...

How to unit test angularjs route's resolve with karma and mocha+chai?

angularjs,unit-testing,ngroute
I am working on an app where I need to resolve promises in the router (ngRoute). The problem is that I am not sure how to write the unit tests for this, I am using karma with mocha and chai. Here is the part of the code I'd like to...