Search Posts

Category: route-provider

Double ng-view/ui-view in AngularJS, is it possible?

I am developing an app with the MEAN stack…and the question is… How can I divide the interface of my app? I have a static page(such a webpage) and an application page, the interface is different but the development that I have followed is… In the file ‘index.js’ of my app, where I put all the dependencies and set the . In this file I have set the header and the footer of the static […]

ngRoute/ng-view not working in angularJs

I have tried google but cannot able to found a solution. Also cross check everything.I have tried many solution but it didn’t solved my problem. Here is my source code. App.js: var app = angular.module(‘myApp’, [‘ngMessages’, ‘ngRoute’]); app.config(function($routeProvider,$locationProvider){ $routeProvider.when(‘/’,{ tempelateUrl:’pages/home.html’ }) .when(‘/second’,{ tempelateUrl:’pages/second.html’ }) $locationProvider.html5Mode({ enabled: true, requireBase: false }); }); HTML file: <!DOCTYPE html> <html lang=”en” ng-app=”myApp”> <head> <meta charset=”utf-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1, shrink-to-fit=no”> <meta name=”description” content=””> <meta name=”author” content=””> <title>Heroic Features – […]

Dealing with %23 replacing id # in angular routing.

The problem: I have a express backend/angularjs frontend web app hosting all of my teams documentation for our users. We frequently need to post links to a specific question (all linked as ids) to our users in Slack. ex. the problem is that when the link is clicked from slack, not when copy/pasted, Slack launches a new browser window/tab to This breaks ngRoute as it no longer recognizes /productTheyNeedHelpWith as the path to […]

routeprovider resolve not restricting access with

how to routeprovider resolve not restricting access with I want to restrict page to only Administrators. I am finding that my auth factory is not completing before resolve returns answer to route. When i follow/watch the code path page gets loaded before the factory finishes. I am thinking i need to do better with promises and /or “.then()”. Any help would be appreciated. Thanks My route code: .when(“/admin”, { templateUrl : “templates/admin.htm”, controller: ‘AdminCtrl’, […]

Reading property resolve from angular $routeProvider error

I am trying to restrict access to some pages within the public directory using Angular routing. .when(‘/adminprofile’, { templateUrl: ‘../partials/adminprofile.html’, access: {restricted: true} }) I am trying to read what I believe is a property called access which I declared, called access ($rootScope, $location, $route, AuthService) { $rootScope.$on(‘$routeChangeStart’, function (event, next, current) { AuthService.getUserStatus() .then(function(){ if (next.access.restricted && !AuthService.isLoggedIn()){ $location.path(‘/login’); $route.reload(); } }); }); }); But what I get is this error: TypeError: next.access […]

AngularJS router loads template before resolved

I have a route that checks whether a user is logged in, using a HTTP request, and then either allows access or redirects to a welcome page. My problem is that the template is loaded and displayed before the route is resolved, and I don’t think this gives a very good user experience. I can’t figure out why this it. From Googling similar problems it seems like using a promise solved the issue, but I’m […]