angular-ui-router

how can I pass custom data to a state from a view in ui-router?

我们两清 提交于 2019-12-20 10:37:07
问题 I'm using $stateProvider for my route configuration. I wanted to take advantage of custom data they provide to pass some custom data from one partial page to the other (on ng-click ). This is the best I got so far: Attach Custom Data to State Objects You can attach custom data to the state object (we recommend using a data property to avoid conflicts). // Example shows an object-based state and a string-based state var contacts = { name: 'contacts', templateUrl: 'contacts.html', data: {

Using 'controller as' with the ui-router isn't working as expected

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 10:03:46
问题 I have the following state setup for a page using an abstract state and the controller as syntax: # Details page route .state 'title', url: '/title', abstract: true, template: '<ui-view/>', .state 'title.show', url: '/:titleId', templateUrl: 'title/show.html' controller: 'Title as t' For the purpose of this demo lets say I assign a variable to the 't' instance of the 'Title' controller and I do this inside of the Title controller function. angular.module('title').controller 'Title', ['$state'

How to trigger UI-Router View Load events?

陌路散爱 提交于 2019-12-20 09:16:29
问题 Testing ui-router for the fist time but testing the Events at the moment and I can't seem to understand how to trigger $viewContentLoaded or Loading. Although, I've got stageChangeSuccess, etc working! I just pushed everything to http://punkbit.com/space_competition/ but also added some code here. I expected to trigger the events when a new view is loaded to ui-view. But I guess I'm missing something here! <div class="pure-g"> <div class="pure-u-1" ui-view> </div> </div> <!-- s: template

How to redirect to state if specific stateParam is empty

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 09:12:50
问题 I'm not sure if the way I am doing it is correct, any advice would be appreciated. I have a Restaurant Selector, which the user can select a restaurant from. Then all other child states load up content specific to the restaurant selected. But I need to have a child state selected by default, including a restaurant, which will be either selected based on the users closest location or on cookie data if they have previously selected one. But, i'm not sure how I can redirect to a child state by

Ionic framework $state.go('app.home'); is adding back button on page where i want to go (how to remove it)?

霸气de小男生 提交于 2019-12-20 08:26:42
问题 I have app with sidebar menu. I am on second page and i'm calling controller function which redirect me to first page using: $state.go('app.home'); Problem is that on this page is now displayed back button next sidebar menu icon, see image below: Could somebody tell me how to deny to add back button into pages which has assigned sidebar menu? Thanks for any help. app.js is with router config is following: angular.module('Test', ['ionic', 'config', 'Test', 'LocalStorageModule']) .run(function(

ui router does not put the content in the named ui-view

情到浓时终转凉″ 提交于 2019-12-20 06:47:33
问题 When I enter the route \#\projects\100\dates\2014-01-01 in the url and press return I get the "projects" state. I expected to trigger "projects.selected.dates" state. Why does the routing not work? Actually it works locally on my machine without named view... http://plnkr.co/edit/0DJ6W7QEPx2UzpdzDrVu?p=preview 'use strict'; angular .module('projectplanner', ['ui.router']) .config(function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise('/projects'); $stateProvider .state(

Share $Scope data between States

ε祈祈猫儿з 提交于 2019-12-20 05:36:38
问题 I am trying access the parent state from a child. I tried this but it doesn't work. angular.module('myApp').controller('compareCtrl', ['$scope', function($scope) { $scope.test=$scope.$parent.services; app.coffee angular .module('myApp', ['ngAnimate', 'ngCookies', 'ngResource' , 'ui.router', 'ngSanitize', 'ngTouch']) .config ($stateProvider) -> $stateProvider.state('home', url: "/" templateUrl: "home.html" ).state('services', url: "/services" templateUrl: "services/list.html" ).state('services

Angular ui-router… Display default tab

十年热恋 提交于 2019-12-20 05:31:46
问题 I am arriving on bookDetails state form some other link. Here bookDetails state's template has links for different tabs (or templates). And associated controller EditBookController has a json file using which I am building forms in different tabs with states like bookDetails.basic and bookDetails.publisher which use parent EditBookController . It's working fine. How to directly display the default bookDetails.basic instead of making user click the link? If I make bookDetails abstract

Angular ui-router nested views don't refresh data retrieved by Angular Services

倖福魔咒の 提交于 2019-12-20 04:54:12
问题 I have a nontrivial Angular SPA that uses ui-router to manage multiple views, many of which are visible at the same time. I need models to be visible across controllers, so I have services written that allow me to have controllers pull down fresh copies of model data that has been updated. I apologize in advance for the length of the question, but I will state the problem then state what I have done to address issues I'm sure others in the Angular community have struggled with. I believe my

How to implement nested secondary routing and still get the data from child? Angular 6

白昼怎懂夜的黑 提交于 2019-12-20 04:53:34
问题 My goal is to send data from a routed child to the parent. I want to get the reference of a variable from the child, which is nested within a child to the parent through secondary routes so that the variable is synced to the parent. This variable will eventually be the boolean of a form validation state. Unfortunately, when I use Behavior Subject I think I have to use the component selector which seems not to play nicely with the routes in my application. This is a sample from the template of