angular-ui-router

Accessing parameters in custom data

点点圈 提交于 2019-12-20 04:18:07
问题 I'm using custom data to add a human readable name to my states, like this: .state('data', { parent: 'week', url: '/data', displayName: 'Data Overview', I can then use it in the template like this: <h1>Showing {{$state.current.displayName}}</h1> Which is nice. But now I want to create a route with a parameter, and use that parameter in the displayName: .state('upload', { parent: 'week', url: '/upload/:level', displayName: 'Data Upload for ' + level, ... But I can't figure out the correct

UI-Router $state.$current wrapper for arbitary state

痞子三分冷 提交于 2019-12-20 03:53:15
问题 Here is the use case. Given a stateConfig object, I can access state.url , but this only returns the URL specified in that configuration object, not the URL that includes the URL's of a state's parents. I need to build the full URL to pass into $urlMatcherFactory.compile, to test for matches. Fortunately, $state.$current provides an extended state object, which allows me to iteratively traverse a state's parents and build the full URL for matching. Unforunately, $state.$current obviously only

UI-Router $state.$current wrapper for arbitary state

醉酒当歌 提交于 2019-12-20 03:53:06
问题 Here is the use case. Given a stateConfig object, I can access state.url , but this only returns the URL specified in that configuration object, not the URL that includes the URL's of a state's parents. I need to build the full URL to pass into $urlMatcherFactory.compile, to test for matches. Fortunately, $state.$current provides an extended state object, which allows me to iteratively traverse a state's parents and build the full URL for matching. Unforunately, $state.$current obviously only

UI-router $stateChangeStart not working at all

不羁岁月 提交于 2019-12-20 03:19:16
问题 this is my app.js var $stateProviderRef = null; var $urlRouterProviderRef = null; var acadb = angular.module('acadb', [ 'ngRoute', 'ui.router', 'ngAnimate', 'ui.bootstrap', 'acadb.controllers', 'acadb.services', 'acadb.filters', 'acadb.directives', 'ngResource', 'angularMoment', 'angularFileUpload', 'ui.materialize', 'angular-toArrayFilter', 'ngSanitize', 'metatags', ]) .run(['$rootScope', '$state', '$stateParams','$http', function($rootScope, $state, $stateParams,$http) { $rootScope.$state =

requirejs with angular - not resolving controller dependency with nested route

依然范特西╮ 提交于 2019-12-20 03:00:35
问题 The RequireJS is not resolving dependency properly when the routes is of multiple levels as in http://www.example.com/profile/view . If I just have http://www.example.com/view , the controller dependency is resolved properly. My bootstrap.js require.config({ baseUrl : 'res/js', paths: { routeResolve: 'routeResolve', 'domReady': 'lib/domReady', angular: 'lib/angular', angularRoute: 'lib/angular-route', angularResource: 'lib/angular-resource', angularSanitize: 'lib/angular-sanitize', cssPath :

How to send object from 1 $state into another $state with ui-router

ⅰ亾dé卋堺 提交于 2019-12-20 02:11:37
问题 https://plnkr.co/edit/nqyBTcBgBimjkrpf2oYo?p=preview Expected After Login Selecting a Ticker button should make the Tags module display the matching Tags for that Ticker. Results After Login Selecting a Ticker button will replace the entire app in the index's ui-view with the Tags $state object. App's current state path: -> login > container > tags The ticker button click in the Tickers component: $scope.clickTicker = function(ticker) { console.log(' Ticker clicked!', ticker) $state.go('tags'

Angular ui-router pressing refresh causes 404 error

风格不统一 提交于 2019-12-20 01:37:22
问题 OK, I know this is an open ended question, but - I'm running an application using AngularJS 1.4.x and ui-router. For the most part everything works fine and as expected. My various pages use ui-sref's to navigate, pages show up as expected, and the URL that's showing looks correct. However, if I refresh the page (F5) on any page at all, it causes a 404 error to occur. And typing in the URL no longer works. Things that might be involved: I turned on the $locationProvider.html5Mode(true) flag I

How to handle angular 5 recursive unknown exact number router parameters?

落花浮王杯 提交于 2019-12-19 21:54:15
问题 Is there a way to handle recursively unknown exact number of router parameters? For example: We have products categories, which can have subcategories, subcategories can have it's own subcategories and so on. There are a few main conditions: if a such category has no subcategories we redirect to /categories/{id}/items that will open items list component. if category has subcategory it should be redirected to next nested tree level /categories/{id}/{id}/.../{id} which should open the last

Ui-sref not generating hash in URL (Angular 1.3.0-rc.3)

空扰寡人 提交于 2019-12-19 21:18:25
问题 Since upgrading from Angular 1.3.0 RC-2 to RC-3 the hash-sign in my links generated by ui-sref has disappeared. The link is clickable and the state transfers happens correctly, but if i copy the link address and paste it in a browser it will land on the wrong page. I dont want to use HTML5Mode. 1.3.0-rc.2 <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style.css"> </head> <body ng-app="myApp"> <div ui-view></div> <script src="https://code.angularjs.org/1.3.0-rc.2/angular.js"><

Ui-sref not generating hash in URL (Angular 1.3.0-rc.3)

隐身守侯 提交于 2019-12-19 21:18:23
问题 Since upgrading from Angular 1.3.0 RC-2 to RC-3 the hash-sign in my links generated by ui-sref has disappeared. The link is clickable and the state transfers happens correctly, but if i copy the link address and paste it in a browser it will land on the wrong page. I dont want to use HTML5Mode. 1.3.0-rc.2 <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style.css"> </head> <body ng-app="myApp"> <div ui-view></div> <script src="https://code.angularjs.org/1.3.0-rc.2/angular.js"><