angular-ui-router

Angular <router-outlet name=“popup”> change URL path structure?

拥有回忆 提交于 2019-12-17 17:03:54
问题 I'm using a popup (refering to the docs): https://angular.io/guide/router#displaying-multiple-routes-in-named-outlets Everything is fine apart from the URL structure: /domain/subPath/(popup:myopoup) How can I change this default structure with parenthesis? I would like it to be as follows: /domain/subPath/popup In other words, I want to remove the brackets including the colon inside the URL. Inside their documentation the popup also appears in that manner (with brackets) Here is some code:

Recursive ui router nested views

拜拜、爱过 提交于 2019-12-17 16:30:16
问题 I am trying to create a file viewer and I want to nest the subdirectories. I am using ui-router and I want each subdirectory to have its own URL and state. Say I have the following structure: Root |__Folder |__Folder |__SubFolder |__SubSubFolder I want my routes to be: files/:folderID/:SubFolderID/:SubSubFolderID And I would like to do that recursively as opposed to creating a new state for each subdirectory 回答1: I would suggest, do it with one state and one param - folderPath . Because ui

How to put reload option in ui-sref markup

时光怂恿深爱的人放手 提交于 2019-12-17 16:27:20
问题 How can I specify the reload option in a ui-sref markup? All the examples I see use the javascript function directly. <a ui-sref="app.editPost({new:true}, {reload:true})">new post</a> Doesn't seem to work. Do I have to create a scope controller function to wrap that reload option instead? I've also tried some answers below and it doesn't seem to work with the Ionic framework. Link to code pen sample below: http://codepen.io/anon/pen/LERqeb 回答1: Here you go: <a ui-sref="app.editPost({new:true}

Why does AngularJS with ui-router keep firing the $stateChangeStart event?

空扰寡人 提交于 2019-12-17 15:28:56
问题 I'm trying to block all ui-router state changes until I've authenticated the user: $rootScope.$on('$stateChangeStart', function (event, next, toParams) { if (!authenticated) { event.preventDefault() //following $timeout is emulating a backend $http.get('/auth/') request $timeout(function() { authenticated = true $state.go(next,toParams) },1000) } }) I reject all state changes until the user has been authenticated, but if I go to an invalid URL that uses the otherwise() configuration, I get an

UI-Router - Change $state without rerender/reload of the page

一世执手 提交于 2019-12-17 15:23:12
问题 I've been looking at these pages (1, 2, 3). I basically want to change my $state , but I don't want the page to reload. I am currently in the page /schedules/2/4/2014 , and I want to go into edit mode when I click a button and have the URL become /schedules/2/4/2014/edit . My edit state is simply $scope.isEdit = true , so there is no point of reloading the whole page. However, I do want the $state and/or url to change so that if the user refreshses the page, it starts in the edit mode. What

Why give an “abstract: true” state a url?

六月ゝ 毕业季﹏ 提交于 2019-12-17 10:18:32
问题 I've be fiddling around with ui-router today in trying to better understand the scaffolding in Ionic and one thing that I noticed was that they give the abstracted state of "tabs" a url. The only times I've ever used abstract states, I used an empty string as the url and I notice that if I've ever accidentally attempted to navigate to an abstracted state (as opposed to the child state) I get the error: Cannot transition to abstract state '[insertAbstractStateHere]' edit: "Moreover, in

scope and controller instantiation with ui router

可紊 提交于 2019-12-17 09:21:55
问题 I am confused about when controllers get instantiated. Also, how do controllers gets instantiated when nesting states. I might be confused how scope gets attached to view and controller, that is, if every view gets its own controller and scope or do they share the same scope. Can someone please explain when controllers get instantiated? Under nested routes do all the views share one controller and scope? What happens when I switch states and go back to a state does another controller get

Directing the user to a child state when they are transitioning to its parent state using UI-Router

别等时光非礼了梦想. 提交于 2019-12-17 08:04:58
问题 Consider the following: .state('manager.staffList', {url:'^/staff?alpha', templateUrl: 'views/staff.list.html', data:{activeMenu: 'staff'}, controller: 'staffListCtrl'}) .state('manager.staffDetail', {url:'^/staff/{id}' , templateUrl: 'views/staff.html', data:{activeMenu: 'staff'}, controller: 'staffDetailsCtrl'}) .state('manager.staffDetail.view', {url:'/view', templateUrl: 'views/staff.details.html', data:{activeMenu: 'staff'}}) .state('manager.staffDetail.view.schedule', {url:'/schedule',

Injecting $state (ui-router) into $http interceptor causes circular dependency

女生的网名这么多〃 提交于 2019-12-17 08:02:00
问题 What I'm trying to achieve I would like to to transition to a certain state (login) in case an $http request returns a 401 error. I have therefore created an $http interceptor. The problem When I am trying to insert '$state' into the interceptor I get a circular dependency. Why and how do i fix it? Code //Inside Config function var interceptor = ['$location', '$q', '$state', function($location, $q, $state) { function success(response) { return response; } function error(response) { if

Injecting $state (ui-router) into $http interceptor causes circular dependency

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 08:01:46
问题 What I'm trying to achieve I would like to to transition to a certain state (login) in case an $http request returns a 401 error. I have therefore created an $http interceptor. The problem When I am trying to insert '$state' into the interceptor I get a circular dependency. Why and how do i fix it? Code //Inside Config function var interceptor = ['$location', '$q', '$state', function($location, $q, $state) { function success(response) { return response; } function error(response) { if