angular-ui-router

Using ui-router for “main” layout?

元气小坏坏 提交于 2019-12-11 02:22:58
问题 I'm trying to create the 'main layout' for my page using ui-router views, but I can't seem to get it working right (various errors, controllers not getting called, templates not getting loaded). <!DOCTYPE html> <html ng-app="App"> <head> ... </head> <body> <header ui-view="header"> </header> <section ui-view="navigation"> </section> <section ui-view="content"> </section </body> </html> The idea is to have a state representing the "root" state for the whole site providing templates for

Angular infinite digest loop with ui-router

最后都变了- 提交于 2019-12-11 01:54:45
问题 The problem I was initially trying to solve was to redirect a user to the login page if they are not logged in and vice versa. I did this with the following code .run(function($rootScope, $http, AppService, $state) { $rootScope.$on('application:refreshtoken', function(rootScope, token) { if(token) { $http.defaults.headers.common['X-Auth-Token'] = token; AppService.setAuthToken(token); AppService.resetLoginTimeout(); } }); $rootScope.$on('$stateChangeSuccess', function() { $http.get('/api

AngularJs data binding not working with ionic

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 01:51:38
问题 I feel like I am missing something obvious with some input text in ionic. I am using angular-ui-router with this route: $stateProvider.state('findPersons', { url : '/findPersons', templateUrl : 'html/findPersons.html', controller : 'findPersonsCtrl' }); This is the text input code in findPersons.html : <div class="bar bar-header item-input-inset"> <label class="item-input-wrapper"> <i class="icon ion-search placeholder-icon"></i> <input type="search" placeholder="Key Word" ng-model="keyWord">

Leaflet map not sizing to dimensions of target element

孤人 提交于 2019-12-11 01:42:57
问题 I am having a hard time getting a leaflet map to render correctly inside a div in my application. It's probably worth mentioning I am using angularJS, angular-material (with flex based layouts) and ui-router, so the page that the div lives on is a template for a state being loaded when the user invokes an action to navigate to that page (e.g. through a navbar item click). My template file for the state is pretty simple: <md-card> <div id='map' style="width: 500px; height: 500px;"></div> </md

Angular ui-router's nested routes not working in ES6 with bable?

不想你离开。 提交于 2019-12-11 01:25:59
问题 I have multiple modules in Angular and I also use nested routes. There is an auth module which also has a sub route auth.login the code goes as follows:- Login.route.js routes.$inject = ['$stateProvider']; export default function routes($stateProvider) { $stateProvider .state('auth.login', { url: '/login', template: require('./login.tpl.html') }); } auth.route.js routes.$inject = ['$stateProvider']; export default function routes($stateProvider) { $stateProvider .state('auth', { url: '/auth',

Possible to hide some parameters in URL with Angular UI Router?

无人久伴 提交于 2019-12-11 00:38:18
问题 I want to pass two values to new ui-view via params: item id list of objects However, I'd like the new view to show only the id in the browser URL and not the stringified array of objects: http://www.myapp.com/#/my-view/4 INSTEAD OF http://www.myapp.com/#/my-view/4?flskdjalfjaewoijoijasdlfkjösldakjföliwejöorijo Is it possible to either a) pass the array of objects hidden to the ui-view or b) pass both but hide the other from the browser URL? I found something about the squash parameter, but

Can't find inline index.d.ts of @uirouter/angularjs

倖福魔咒の 提交于 2019-12-11 00:13:21
问题 I'm using the latest Typescript version with Angularjs 1.6.4 and ui-router, using VS Code. Currently I'm using the @types folder for type definitions. There's this problem with Typescript definitions file I've been having for quite some time - namely with moment.js and now when I tried upgrading "angular-ui-router" to the new nested @uirouter/angularjs. The problem seems to be that typescript doesn't know to look at the "Typings" field in the package.json file of external libraries for their

Angular-ui-router child state with multiple parent states

☆樱花仙子☆ 提交于 2019-12-11 00:08:24
问题 Using Angular-ui-router , is there a possibility to define a child-state that has multiple parent states : $stateProvider .state("parent1", { url: '/', templateUrl: 'parent1.html' }) .state('parent2', { url: '/parent2', templateUrl: 'parent2.html' }) //Make accessible from every state parent-state .state("child", { url: 'child', //TODO parents: ['parent1', 'parent2'] onEnter: function() { //do something; } }) Example : Your Angular app has a directive that is used multiple times in different

Filter in ui-sref

耗尽温柔 提交于 2019-12-10 23:29:51
问题 I am trying to apply a filter on a parameter in my ui-sref reference. <a ui-sref="item.show({ itemId: item.id, itemName: item.name | slugify })"> However, the above is not working. How to I apply the slugify filter to item.name ? 回答1: You can use a function: <a ui-sref="item.show({ itemId: item.id, itemName: getSlugifiedName(item) })"> And in your controller, something like that: $scope.getSlugifiedName = function (item) { return $filter('slugify')(item.name); } 回答2: Use parentheses for

Angular UI Router root named view template change from child view

有些话、适合烂在心里 提交于 2019-12-10 22:43:58
问题 Setup is using Angular v1.5.8, and ui-router v0.3.1 . My root view has several named sections (ive removed a number of them for brevity). It looks like this <section id="container"> <div id="main"> <div id="overlay"> <section id="overlay__content" ui-view="overlay"></section> </div> <div id="content"> <section id="content__content" ui-view="content"></section> </div> </div> </section> My state controller looks like this $stateProvider .state('app',{ url: '/', abstract: true, views: { 'overlay