ngroute

How to inject ngRoute into Jasmine / Karma AngularJS unit test?

谁都会走 提交于 2019-12-12 20:28:15
问题 I'm trying to get a basic unit test example working. It all works fine with this app.js var whapp = angular.module('whapp', []) .filter('reverse',[function(){ return function(string){ return string.split('').reverse().join(''); } }]); and this spec.js describe('Filters', function(){ //describe your object type beforeEach(module('whapp')); //load module describe('reverse',function(){ //describe your app name var reverse, rootScope; beforeEach(inject(function($filter){ //initialize your filter

AngularJs : Cancel route resolve without promise

谁说我不能喝 提交于 2019-12-12 18:03:33
问题 I need to cancel my route in case of wrong login, this is my ANGULARJS NG-ROUTE code : monApp.config(function ($routeProvider, $locationProvider){ var rsf = { // This function tells if user is logged or not "check":function(stockeUtilisateur,$location,Notification){ u = stockeUtilisateur.getUtilisateur(); if(u.role=='admin'||u.role=='utilisateur'){ Notification.success("Youre logged"); } else{ $location.path('/accueil'); //redirect user to home. Notification.error("bad password"); } } };

AngularJS ngRoute direct part access

醉酒当歌 提交于 2019-12-12 06:13:18
问题 My app works fine with ngRoute, but when I'm trying to access my parts directly(from address bar), it returns just the part (without main page). How to hide these parts from a direct access? Explanation: I have a site with 2 blocks. First is a menu and second is a content (one of my route's part). Menu has links: "#/main" and "#/account". When I press on the buttons, it works fine (left menu and content). But if I change URL from localhost:8080/#/account to localhost:8080/account, it renders

Angularjs: Uncaught ReferenceError $rootScope is not defined

假如想象 提交于 2019-12-12 05:37:34
问题 I am trying to run and got this message: Uncaught ReferenceError: $rootScope is not defined at app.js line 12 here is my js/app.js angular.module('addEvent', ['ngRoute']) .config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $routeProvider.when('/add-event', { templateUrl: 'views/add-event.html', controller: 'formCtrl', controllerAs: 'eventCtl' }) .otherwise({ redirectTo: '/' }); $locationProvider.html5Mode(true); }]) .run(['$rootScope', function() {

AngularJS router does not load page served at `templateURL`

ⅰ亾dé卋堺 提交于 2019-12-12 03:31:26
问题 This is my HTML page (which gets served when accessing the path / ): <form ng-submit="ctrl.loginUser()" name="myLoginForm"> <div class="form-group"> <label>Username</label> <input type="text" name="uname" class="form-control" ng-model="ctrl.loginuser.username" required> </div> <div class="form-group"> <label>Password</label> <input type="password" name="pwd" class="form-control" ng-model="ctrl.loginuser.password" required> </div> <input type="submit" value="Login"> </form> <div ng-view></div>

Unable to redirect using angular routeprovider

岁酱吖の 提交于 2019-12-12 03:07:50
问题 i am new to angular i when i am not able to redirect to the signup.html page when i hit the locahost:port/projectname/ eventhough i specified the template url for singup in app.js i am getting 404 but when i hit the locahost:port/projectname/signup.html the file was opening am i doing anything wrong? i want to get the signup.html when i hit locahost:port/projectname/ app.js var app = angular.module('pollApp', ['ngRoute']); app.config(['$routeProvider',function($routeProvider){ $routeProvider

Error ngRoute is not available

喜夏-厌秋 提交于 2019-12-11 23:54:32
问题 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 src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js" type="text

multiple configuration in AngularJS module

非 Y 不嫁゛ 提交于 2019-12-11 20:13:37
问题 I am using ng-route and ng-translate at the same time, where both require configuration in the module. Apparentely my routing is working but my ng-translate is haveing problems of being in the same confing with routing configuration. "use strict"; (function(){ var app = angular.module('ratingApp', ['ngRoute', 'ui.bootstrap', 'ngMessages', 'ngFileUpload', 'ngAnimate', 'pascalprecht.translate']); app.config(function($routeProvider, $translateProvider){ $routeProvider .when('/', { templateUrl:

Can I set a parameter using ngRoute?

跟風遠走 提交于 2019-12-11 14:03:33
问题 I am making an app that shows a list of items, and that list can then be refined by multiple filters. If I were to fetch a list of those options from the URL string, then that would allow visitors to share (or bookmark) a link that takes you to a filtered list of data. But my questions is how would I write those options to the URL string? So the idea is that once a select element has been changed, to refine the results. Let's say for example that it's just the order of the items. <select ng

Get current controller in use in angularjs

≡放荡痞女 提交于 2019-12-11 10:37:29
问题 I want to log the usage of different features in our Angularjs application. Current feature in use is usually identified by the current route/url in browser but there are some features which open in a modal/popup or with ngInclude without change in route/url. Is there any central way to identify which feature is in use currently, i thought of getting the current top level controller in use but unfortunately don't know how to get it. Any other idea for that purpose? P.S. I am using ngRoute.