angular-ui-router

ui-sref not working in nested views

南笙酒味 提交于 2020-01-06 12:51:38
问题 Homework I've done - reviewed almost 8-9 ui-sref related questions (how to, complex examples, etc.) on this site, the related plunks, Scotch.io, etc. I can't seem to figure why my code is not working. I've spent 6-7 hours debugging the app and I can't seem to find the issue. My page is divided into a) layout.html - this forces the bootstrap grid system b) app-navbar - nav bar on top (code is cut-n-paste of bootstrap example for now...) c) app-accordion - uses the ui bootstrap accordion to

How to preserve scope data when changing states with ui-router?

只愿长相守 提交于 2020-01-06 07:21:07
问题 I'm building a single page web app using AngularJS with ui-router. I have two different states, one parent and one child. In the parent state, 'spots', users can make a selection from an ng-repeat and their selection is shown using the scope. When a user makes the selection, I have ng-click fire a function which uses $state.go to load the child state 'details'. I would like to load their selection in the child state, but it appears that the scope data is gone? I've tried using the same

When has ng-switch finished rendering?

有些话、适合烂在心里 提交于 2020-01-06 03:17:06
问题 I'm using ui-router and trying to instantiate a widget that takes as a parameter a DOM element specified by id. This DOM element is in a <div ng-switch> and I want to call the widget constructor when the element is guaranteed to exist. <div ng-switch on="state"> <div ng-switch-when="map"> <div id="map"></div> </div> </div> From the ui-router lifecycle, I understand that I should hook into $viewContentLoaded . This, however, doesn't work - the DOM element within the ng-switch isn't created at

When has ng-switch finished rendering?

独自空忆成欢 提交于 2020-01-06 03:16:11
问题 I'm using ui-router and trying to instantiate a widget that takes as a parameter a DOM element specified by id. This DOM element is in a <div ng-switch> and I want to call the widget constructor when the element is guaranteed to exist. <div ng-switch on="state"> <div ng-switch-when="map"> <div id="map"></div> </div> </div> From the ui-router lifecycle, I understand that I should hook into $viewContentLoaded . This, however, doesn't work - the DOM element within the ng-switch isn't created at

Modal not showing correctly when i put it into a Directive

允我心安 提交于 2020-01-05 04:44:23
问题 I can't reproduce the AngularStrap's example, here a working plunk What I get when I integrate this example in my code: (As you can see it's a bit darker, i don't know why...) What I'm expecting: Actually I spent a whole day looking for solution for this but no luck. guest.html <body ng-app="module.app"> <div class="container-fluid"> <nav class="navbar navbar-inverse navbar-static-top"> <div topbar></div> </nav> <div class="row"> <div ui-view></div> </div> </div> </body> topBar directive.js :

Change state of angular app from resolve method of state provider

谁都会走 提交于 2020-01-04 04:39:14
问题 I'm using ui-router in my angular application. Currently I've two routes /signin & /user. Initially it shows /signin when the user clicks on the login button, I'm sending a ajax request and getting the user id. I'm storing the user id in localstorage and changing the state to /user. Now, what I want, if a user is not loggedin, and user changes the addressbar to /user, it'll not change the view, instead it'll change the addressbar url to /signin again. I'm try to use resolve, but it's not

How to pass array to AngularJS app via url using ui.router module

两盒软妹~` 提交于 2020-01-04 01:52:11
问题 I use Angular 1.5 and ui.router module and want to pas int array to app throw url. www.example.com/#/filter?[1,2,5] or www.example.com/#/filter/[1,2,5] or something else. .state('cats', { url: '/filter?catsIds', // or /filter/{catsIds} templateUrl:'cats.html', controller: 'catsCtrl' }) goal: app.controller('catsCtrl',function($stateParams){ console.log(Array.isArray($stateParams.catsIds)) // goal true ... 回答1: You can't pass object through an ui-router parameter, I'd say while passing value

Angular Js Routing Google Chrome Issue

こ雲淡風輕ζ 提交于 2020-01-03 08:58:09
问题 Worked on basic routing in angular Js with Code1 mentioned below and getting " XMLHttpRequest cannot load Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource " error and founded that we must use local web server to resolve the same and downloaded MAMP and kept my html[login.html] in htdocs folder started the server and replaced templateUrl with [localhostURL/AngularJs/login.html'] as mentioned in Code2 and getting error

Angular Js Routing Google Chrome Issue

混江龙づ霸主 提交于 2020-01-03 08:58:06
问题 Worked on basic routing in angular Js with Code1 mentioned below and getting " XMLHttpRequest cannot load Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource " error and founded that we must use local web server to resolve the same and downloaded MAMP and kept my html[login.html] in htdocs folder started the server and replaced templateUrl with [localhostURL/AngularJs/login.html'] as mentioned in Code2 and getting error

AngularJS ui-router optional parameters

放肆的年华 提交于 2020-01-03 07:09:26
问题 I tried to set up my routing like this ... url: '/view/:inboxId?' ... but Angular would throw this error: Error: Invalid parameter name '' in pattern '/view/:inboxId?' so basically I had to set up two different states: state('view', { url: '/view/:inboxId', templateUrl: 'templates/view.html', controller: 'viewCtrl' }). state('view_root', { url: '/view', templateUrl: 'templates/view.html', controller: 'viewCtrl' }) Is there any way to combine these states into one? 回答1: To have an optional