angular-ui-router

Manage different base layouts in Angular2

偶尔善良 提交于 2019-12-12 17:26:14
问题 In my angularjs application with ui.router I can do following: $stateProvider .state('app', { url: '', abstract: true, template: '<div data-ui-view></div>' }) .state('app.auth', { url: '', abstract: true, controller: 'AuthShellController as vm', templateUrl: 'views/auth/auth-shell-view.html' }) .state('app.ui', { abstract: true, templateUrl: 'views/ui-shell-view.html', controller: 'ShellController as vm' and my angular2 application routes config: const appRoutes:Routes = <Routes>[ { path: '',

UI-Router multiple named views not working

荒凉一梦 提交于 2019-12-12 17:23:51
问题 I try to use the multiple named view of UI-Router but it's not working. See following example to understand my problem : start.html <body ng-app="startApp"> <div ui-view="navigation"></div> <div ui-view="content"></div> </body> nav.html <nav> <ul> <li>btn1</li> <li>btn2</li> </ul> </nav> content.html <h1>My content</h1> app.js angular.module('startApp', ['ngAnimate', 'ui.router', 'ngFileUpload', 'ngImgCrop']) .config(function ($stateProvider, $urlRouterProvider) { $stateProvider .state('start

AngularJS UI-Router navigate without removing query params

谁说我不能喝 提交于 2019-12-12 17:23:10
问题 I'm using UI-Router to manage the states of my application, and I have query params where I save some data about the application. I'm using ui-sref no navigate to another state, but this removes the query params from the URL. Is there any way to change the state of the application without removing the query params? 回答1: There is an option {location : false} - check the doc: go(to, params, options) ... Options object. The options are: location - {boolean=true|string=} - If true will update the

ng-click not firing, deep inside ui-views

混江龙づ霸主 提交于 2019-12-12 16:23:15
问题 I am using AngularJS and ui-router. I have a submenu which opens when they click their username, inside of which I want a logout button. It's a div with an ng-click that should log out the user; however, the ng-click is never firing. This bit just shows/hides the subMenu <div class="user-view-content" ng-init="showSubMenu = false" ng-click="showSubMenu = !showSubMenu"> {{getUsername()}} <span class="glyphicon glyphicon-chevron-down"></span> </div> And the content of the subMenu - ng-click

angular ui-router, html5 mode always refreshes to /

て烟熏妆下的殇ゞ 提交于 2019-12-12 16:22:29
问题 I am trying to use html5mode in angular, so that I can bookmark a page like http:/myhost/products (where /products is a route defined by$stateProviderRef.state(xxx) ). To that end I've added $locationProvider.html5Mode(true) to my app config added 'base href="/"' (with the <>) to my index.html added the catch all rewrite to my server.js in node.js app.get('*', function(req, res) { res.redirect('/'); }); restarted the node server so what happens is that the app starts ok, all navigation works,

Angular 4 - routerLinks without starting slash get rewritten after uncaught error

别来无恙 提交于 2019-12-12 16:18:35
问题 This is a follow up to Angular 4 + zonejs: routing stops working after uncaught error since we had a hard time integration the suggested changes into our project. The reason for this can be seen in this adapted plunker https://embed.plnkr.co/oUE71KJEk0f1emUuMBp8/ in app.html: The routerLinks in our project were not prefixed with a slash "/". This breaks the whole navigation once you navigate to another section after visiting the "Error Component". All links are being rewritten with the

Angular UI Router: keeping sibling views around on state change

岁酱吖の 提交于 2019-12-12 15:25:55
问题 I have a classic set-entity situation whereby the user chooses an item from a list and it is displayed in a view next to the list. A typical way of implementing this with UI router would be to have a template which holds the html for the list and an ui-view for a list item, and the item state is a child of the list state. I would however like the item and list states to be siblings instead, with their templates being plugged into named ui-views: $stateProvider.state("inbox", { abstract: true,

UI-Router : Can I get always the same controller?

梦想的初衷 提交于 2019-12-12 15:15:09
问题 I'm using UI-Router to have some "menus" in my application. $stateProvider.state("list" url: "/Focales" templateUrl: "/demo/focals.html" controller: FocalCtrl) $stateProvider.state("collection" url: "/Collections" templateUrl: "/demo/collections.html" controller: CollectionCtrl) In my CollectionCtrl, I trigger a processing done on server and just waiting to display the information like this (CoffeeScript) Progress = $resource('/collections/getProgress') $scope.getProgress = () -> prg =

$stateChangeStart don't work when user refresh browser

一世执手 提交于 2019-12-12 14:03:54
问题 Please, I'm using ui-router on my project. $stateChangeStart event work fine when the user navigate between the states. But it doesn't work if I refresh the browser. This is my source code: (function(){ 'use strict'; angular.module('app.overlay') .directive('ibLoading', ['$rootScope' , '$timeout', loading]); function loading($rootScope , $timeout){ console.log("In dirrective"); var directive = { restrict:'EAC', link:link }; function link(scope, element) { $rootScope.$on('$stateChangeStart',

header hide for a particular page in my angular

我们两清 提交于 2019-12-12 12:11:58
问题 I m working on angular project and my need is hide header block on login page only. I tried to hide header on login page. But it still doesn't work for me. Can you any one help me to hide it on login state. Here my index html <div ng-include src="'views/header.html'" ng-hide="$state.current.name === 'login'"></div> <div class=""> <div ui-view></div> </div> Here my app.js var app = angular.module('Qapp', ["ui.router", "ngRoute"]) app.config(function($stateProvider, $urlRouterProvider) { //