angular-ui-router

Angular JS: Async factory call issue

一世执手 提交于 2019-12-21 05:41:11
问题 I'm new to angular and I'm creating a simple app. It navigates between projects, pulled in via JSON: http://plnkr.co/edit/FTfa1rcVaf85xTu65oSR?p=preview I am also using a factory, where I make a call such as get or getOne , so that it deals with the $http in one place, only calling it if the data hasn't already been fetched. This all works fine when you start on the home page, but when you start on an individual project page, both get and getOne are called at the same time, pulling in

Angular JS: Async factory call issue

落爺英雄遲暮 提交于 2019-12-21 05:41:01
问题 I'm new to angular and I'm creating a simple app. It navigates between projects, pulled in via JSON: http://plnkr.co/edit/FTfa1rcVaf85xTu65oSR?p=preview I am also using a factory, where I make a call such as get or getOne , so that it deals with the $http in one place, only calling it if the data hasn't already been fetched. This all works fine when you start on the home page, but when you start on an individual project page, both get and getOne are called at the same time, pulling in

How to combine passport and angular-ui routing

你说的曾经没有我的故事 提交于 2019-12-21 05:16:13
问题 I'm wondering how I can combine angular-ui-routing with passport. All examples I find are using the node.js routing there for. var routerApp = angular.module('routerApp', ['ui.router']); routerApp.config(function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise('/home'); $stateProvider .state('home', { url: '/home', templateUrl: 'partial-home.html' }) .state('about', { // for example just show if is loggedIn }); How would I implement this function in the above snippet?

Angular 1.4.1 UI Router 10 $digest() iterations when $state.go called on $stateChangeStart

淺唱寂寞╮ 提交于 2019-12-21 05:09:06
问题 I have a state that requires authorization. I listen to the $stateChangeStart event and if the toState.data.protected and the user is not authorized I call e.preventDefault() and $state.go('login') . When I open the app in root url I'm automatically redirected to protected state. This causes 10 $digest loops and I end up in the login state when I open the app in the root url and I'm automatically redirected to a protected state. Uncaught Error: [$rootScope:infdig] 10 $digest() iterations

Directives isolated scope not working properly together with nested views? (AngularJS / UI Router)

喜夏-厌秋 提交于 2019-12-21 02:53:16
问题 I'm using ui-router in a AngularJS project where I have a nested view that contains a custom directive. This directive renders an input field (lets say a filter-field) and its value should be in sync with the controller's scope. This works well for this directive, when the view/state not is nested: jsFiddle / not nested / working as expected var myApp = angular.module('myApp', ['ui.router', 'myComponents']) .config(['$stateProvider', function ($stateProvider) { $stateProvider. state('home', {

“optional” params in AngularJS states/views with ui-router

烂漫一生 提交于 2019-12-20 16:25:17
问题 I have a customer search view that, by default, simply loads a form for first and last name. It can, however, take those params as arguments in the URL. My app config contains: $stateProvider .state({ name: "search", url: "/search", templateUrl: "partials/customerSearch.html", controller: "CustomerSearchCtrl" }) .state({ name: "searchGiven", url: "/search/:fn/:ln", templateUrl: "partials/customerSearch.html", controller: "CustomerSearchCtrl" }) This works, but it seems like it has unnecessary

Angular-Ui-Router, nested named views - what am I doing wrong?

痴心易碎 提交于 2019-12-20 15:24:00
问题 I'm trying to implement a very simple example using nested named views using ui-router, and I can't get it to work. If anyone could look at this jsFiddle - http://jsfiddle.net/thardy/eD3MU/ - and tell me what I'm doing wrong, I'd greatly appreciate it. The basic idea is this: - My index.html has a single ui-view - The template that gets plugged into that has two, named ui-views - I'm trying to setup the configuration to populate these two ui-views with templates and I can't get it to work

How to get angular ui-router's ui-sref to work, when inside a directive's template?

大兔子大兔子 提交于 2019-12-20 10:54:38
问题 Basically, I am trying to change/customize the behaviour of the ui.bootstrap.accordion. All is working, except for integration with ui-router. Here's the way I want to use the accordion: <accordion> <!-- this element is actually separate view in a parent state of the accordion-group's below.--> <accordion-group ui-sref="site.home.newsID_1"> <!-- accordion-groups will be generated with ng-repeat.--> <accordion-heading> News 1 </accordion-heading> <p>This is</p> </accordion-group> <accordion

angularjs: conditional routing in app.config

半腔热情 提交于 2019-12-20 10:41:58
问题 I'm facing an issue in angular.js ui-router and not able to sort it out . Issue: I want user to access all routes defined in config if the user is EnterpriseAdmin and restrict some routes if the user is Enterprise user. Routes are defined in config: var adocsModule = angular.module('myApp', ['ngResource', 'ngRoute','ui.bootstrap','ui.router', 'ngAnimate']) .config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) { $stateProvider.state('Registration', {

How to use $transitions?

纵饮孤独 提交于 2019-12-20 10:37:08
问题 Currently, I'm using: "angular-ui-router": "^0.4.2" "angular": "^1.6.3" "webpack": "^2.4.1" I am aware of my current implementation might be deprecated, just looking for the implementation(an example or documentation) of the new method. Any help is greatly appreciated, thanks in advance! Current implementation: 'use strict'; module.exports = angular .module('common', [ 'ui.router', 'angular-loading-bar', require('./header').name, require('./sideBar').name, require('./footer').name ]) .run