angular-ui-router

Angular animate parent div of ng-view using element insde ng-view

拜拜、爱过 提交于 2019-12-11 12:00:34
问题 Is it possible to css animate a div (background-color) that is outside the ng-view, using a directive on a $state inside the ng-view? The ng-view has css animations for the routing. If I do not animate the div then the ng-view anims work fine, but.. If I add animation classes to the div(bgId) then the routing anims do not fire. Here is a sample of html: (Button added as example - would normally be in the template pages eg. home.html / login.html ) <body ng-app="app" ng-controller="MainCtrl">

Passing result of resolve into controller with UI-Route

这一生的挚爱 提交于 2019-12-11 11:58:34
问题 I'm trying to learn how to use resolves with UI-Router, and I think there's a piece of information I'm missing, because I can't figure out how to make them work. I have a state set like this: app.config(['$stateProvider', function($stateProvider) { $stateProvider .state('testState', { url: '/testRoute', controller: 'TestContoller', views: { "body": { templateUrl: "testHtml.html" } }, resolve: { test: function(){ return {value: "test"}; } } }) }]); And then I have a controller: app.controller(

AngularJs UI-Router - $stateProvider can't read my abstract state

拜拜、爱过 提交于 2019-12-11 11:50:03
问题 I have problem with html5Mode. In my MVC project I have only one controller public class HomeController : Controller { public ActionResult Index() { return this.File("index.html", "text/html"); } } In my angular project I have two routes and one abstract. angular.module('app').config(function ($urlRouterProvider, $stateProvider, $locationProvider) { // if none of the above states are matched, use this as the fallback $urlRouterProvider.otherwise('/app/articles'); $stateProvider .state('app',

Angular ui-router variable in nested view

*爱你&永不变心* 提交于 2019-12-11 11:49:08
问题 I'm currently working on an app where I have multiple nested views, they sort of look like this: - ui-view - ui-view="header" - ui-view="nav" - ui-view="body" My states are defined as follows: .state('index', { url: '', // default route templateUrl: 'welcome.html' }) .state('app', { abstract: true, templateUrl: 'app.template.html' // This template contains the 3 different ui-views }) // I'm using a different state here so I can set the navigation and header by default .state('in-app', {

Controlling order of operations with services and controllers

≯℡__Kan透↙ 提交于 2019-12-11 11:19:27
问题 I have two services - one to store user details and the other to make a call to retrieve those details: userService stores user details to be used across the entire app (i.e. injected in controllers, services, etc.) function userService($log) { var id = ''; var username = ''; var isAuthenticated = false; var service = { id: id, username: username, isAuthenticated: isAuthenticated }; return service; } authService is used (hopefully just once) to retrieve the user details from a Web API

Angular UI Router resolve throwing provider error

∥☆過路亽.° 提交于 2019-12-11 11:09:16
问题 I seem to be having an issue with Angular UI router and trying to add a resolve to a state. The weird thing is, that I have it in another place and it works fine. I'm separating my code out into different component areas, my code structure is like this: /app /component-dashboard index.js /controllers DashboardCtrl.js /component-chart-1 index.js /controllers Chart1Ctrl.js For example I have the root dashboard and this works fine: // index.js angular.module('az-ci') .config([ '$stateProvider',

How to fire function after parameter change, but not when navigating to a new route

折月煮酒 提交于 2019-12-11 10:47:49
问题 I need to fire an event whenever the user navigates forwards or backwards through their browser history, but only while on a particular route. I've tried using $scope.$on('$locationChangeSuccess', function... within the controller for this route, but this will fire even if I'm navigating to a completely different route using the browsers forward and backward buttons. I was able to prevent this behavior when navigating forwards through the browser history by checking $location.path() and only

ui-router: open state in new tab with target=“_blank” with object params

馋奶兔 提交于 2019-12-11 10:39:38
问题 I am using ui-router for state navigation in angular application and in one of the scenario I have to navigate to a new state in an different tab. I have the following state .state("code", { url: "/code", params: { offer : null }, templateUrl: "app/components/coupons/views/code.html" }) offer in param is an object. When navigating to this state in the same browser it works fine. But when navigating to this state in a different browser offer comes as null. The same question was posted by

how to make nested ui-router execute child controller every route change

匆匆过客 提交于 2019-12-11 10:22:37
问题 The following is my ui-router configuration. I hope that the child controller will be executed when I change the child state every time. But now, the child controller be executed only the first time I change the child state. Is someone could help me? $stateProvider .state('tab', { url: '/tab', abstract: true, templateUrl: 'views/tabs.html' }) .state('tab.order-foods',{ url:'/order-foods', views:{ 'tab-order-foods':{ templateUrl:'../views/tab-order-foods.html', controller:'orderFoodsCtrl' } }

Using UI-Router - Is it possible to set only single ui-view using regular syntax?

烂漫一生 提交于 2019-12-11 09:55:26
问题 In one of my templates , I have this code : <h1>Route 1</h1> <hr/> <a ui-sref=".list">Show List</a> <a ui-sref=".thing">thing7</a> <div ui-view="left"></div> <div ui-view="right"></div> When I click the .list state - I do have a controller with the appropriate configuration : ....state('route1.list', { url: '/list', views: { 'left@route1': { templateUrl: 'route1.list.html', controllerAs: "vm", controller: function ($scope) { this.items = ["a", "b", "c", "d"]; } }, 'right@route1': {