angular-routing

Reloading the page gives wrong GET request with AngularJS HTML5 mode

浪子不回头ぞ 提交于 2019-12-16 19:19:33
问题 I want to enable HTML5 mode for my app. I have put the following code for the configuration, as shown here: return app.config(['$routeProvider','$locationProvider', function($routeProvider,$locationProvider) { $locationProvider.html5Mode(true); $locationProvider.hashPrefix = '!'; $routeProvider.when('/', { templateUrl: '/views/index.html', controller: 'indexCtrl' }); $routeProvider.when('/about',{ templateUrl: '/views/about.html', controller: 'AboutCtrl' }); As you can see, I used the

Reloading the page gives wrong GET request with AngularJS HTML5 mode

大城市里の小女人 提交于 2019-12-16 19:17:59
问题 I want to enable HTML5 mode for my app. I have put the following code for the configuration, as shown here: return app.config(['$routeProvider','$locationProvider', function($routeProvider,$locationProvider) { $locationProvider.html5Mode(true); $locationProvider.hashPrefix = '!'; $routeProvider.when('/', { templateUrl: '/views/index.html', controller: 'indexCtrl' }); $routeProvider.when('/about',{ templateUrl: '/views/about.html', controller: 'AboutCtrl' }); As you can see, I used the

Angular 2 Routes

梦想的初衷 提交于 2019-12-14 03:36:14
问题 I have one router-outlet in my app.html .problem is i have 3 (post,admin,addposts)component except app.component .in my posts component i have dropdown menu onece i click dropdown i want load addposts and the url should be look like this post/addposts. any idea how to do this this is my app.routes.ts const routes: Routes = [ { path: '', redirectTo: 'main', pathMatch: 'full'}, { path: 'main', component:AdminBodyComponent }, { path: 'admin', component:AdminComponent }, { path: 'posts',component

AngularJS and Web API form authentication

隐身守侯 提交于 2019-12-14 03:11:42
问题 I'm new to AngularJS and I'm starting to create a sample application, this application has 2 views: Login View Welcome View Everything is working fine with my AngularJS dummy application but now I start implementing the Login functionality on server side: [HttpPost] public JsonResult Login(string credentials) { bool returnVal = false; if (!string.IsNullOrEmpty(credentials)) { FormsAuthentication.SetAuthCookie("DUMMY USER", true); } return Json(new { success = returnVal }, JsonRequestBehavior

Outlook add in not work with Angular routing under Mac OS(High Sierra 10.13.1)

半城伤御伤魂 提交于 2019-12-13 04:22:20
问题 After updated to latest Mac OS (High Sierra 10.13.1), our outlook web add in not function properly, the page is blank, the reason is the url specified in the add-in manifest is not matched by angular route which is further caused by a wrong manipulated url. The url I specified in the manifest is https://localhost:4004/#!/main/viewschedule But the actual I got from window.location.href is: https://localhost:4004/?_host_Info=Outlook$Mac$16.01$en-US%23!/main/viewschedule Please note %23 in the

'UI-Router-Extras' - Can't Attach / Add New 'FutureState' Objects After App.Config() Has Already Loaded

半城伤御伤魂 提交于 2019-12-13 03:34:32
问题 I am having problems with adding new states to the runtime phase of my app using ' UI-Router-Extras '. I have been trying for quite some time now to get new states attached and loaded AFTER a user has successfully authenticated using the ' UI-Router-Extras ' plugin 'ui-router-extras' Here is a reference to the 'UI-Router-Extras' Examples for the FutureState documentation that i'm using, but I feel like maybe my scenario is either slightly different that what's shown or I'm missing something

Angular 2+ : canLoad usage

萝らか妹 提交于 2019-12-13 03:01:38
问题 I'm trying to use the canLoad function with routes, but it doesn't seem to work. I don't know why, maybe you can't use it with canActivate or something, but since I don't know, I thought someone would here. The code runs, when serving with aot compilation I get this : chunk {admin.module} admin.module.chunk.js, admin.module.chunk.js.map () 28 kB {main} {pilotage.module} {suiviprod.module} chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] chunk {main} main.bundle

Resolve login in $routeProvider using controller

半世苍凉 提交于 2019-12-12 18:09:37
问题 I'm trying to restrict a user's access to a /topics view and a /question view. I have a login form on the home page. My HomeCtrl has the following login function: $scope.doLogin = function() { var user = { username: $scope.username, password: $scope.password } $http.post('data/user/users.json', user ).success(function(data, status, headers, config) { userService.isAuthenticated = true; userService.username = data.username; userService.password = data.password; $location.path('/topics');

Angular2 - Routing not working when using router-outlet name

一世执手 提交于 2019-12-12 14:19:47
问题 I'm trying to give a name to the router-outlet but it is not working. This is the basic routing that works perfectly: routing module @NgModule({ imports: [ RouterModule.forChild([ { path: 'admin', component: AdminComponent, children: [ { path: '', redirectTo: 'dashboard1', pathMatch: 'full' }, { path: 'dashboard1', component: AdminDashboard1Component }, { path: 'dashboard2', component: AdminDashboard2Component } ] } ]) ], exports: [ RouterModule ] }) export class AdminRoutingModule { }

Angular Parent and Child Modules Chunk sizes issue

纵然是瞬间 提交于 2019-12-12 13:16:03
问题 I have application structure like this: 1. app 1. Shared Module 2. Modules 1. ExternalSourceModule Child Modules 1. SourceModule 2. EntityModule ExternalSourceSharedModule ExternalSourceSharedModule imports SharedModule because shared module has application level dependencies ExternalSourceModule and it child modules imports ExternalSourceSharedModule because ExternalSourceSharedModule has some dependencies which ExternalSourceModule and it's Child Modules Needs Code of