How to ng-hide and ng-show views using angular ui router?

Angular’s ui-router offers a clean method for toggling nested views. First inject $state into your hypothetical “list page” controller. Then expose it to the local $scope: .controller(‘ListPageCtrl’, function($scope, $state) { $scope.$state = $state; }) The $state variable we injected has a nice “includes” method. $state.includes() takes a string as an argument and checks that string … Read more

Circular dependency found: $http

It appears that $state service is resulting in a circular dependency with the $http service. This may be caused by the fact that the templateFactory (see https://github.com/angular-ui/ui-router/blob/master/src/templateFactory.js) is being injected with the $http service in addition to the interceptor itself being composed with the $http service. To get around this circular dependency issue, you can … Read more

How can I use ng-animate with ui-view rather than ng-view?

The bug is now closed and they’ve added an entry over at the ui-router Wiki. It also includes a demo Plunkr. I will copy the code example here, just in case the URL would become outdated. HTML: <div class=”row”> <div class=”span12 ui-view-container”> <div class=”well” ui-view></div> </div> </div> CSS: /* Have to set height explicity on … Read more

Using $state methods with $stateChangeStart toState and fromState in Angular ui-router

Suggestion 1 When you add an object to $stateProvider.state that object is then passed with the state. So you can add additional properties which you can read later on when needed. Example route configuration $stateProvider .state(‘public’, { abstract: true, module: ‘public’ }) .state(‘public.login’, { url: ‘/login’, module: ‘public’ }) .state(‘tool’, { abstract: true, module: ‘private’ … Read more

Apply loading spinner during ui-router resolve

You can use a directive that listens on $routeChangeStart and for example shows the element when it fires: app.directive(‘showDuringResolve’, function($rootScope) { return { link: function(scope, element) { element.addClass(‘ng-hide’); var unregister = $rootScope.$on(‘$routeChangeStart’, function() { element.removeClass(‘ng-hide’); }); scope.$on(‘$destroy’, unregister); } }; }); Then you place it on the specific view’s loader, for example: View 1: <div … Read more

How does ionic history work and when is a non-root stack created?

I’ll try to answer this question even if you might not find all the info you’re asking. Lot of people – included myself – seem to struggle to understand how the navigation system and the history works. I’ve answered a question earlier trying to explain why things don’t work as expected. It seems the navigation … Read more

UI-Router – Change $state without rerender/reload of the page

For this problem, you can just create a child state that has neither templateUrl nor controller, and advance between states normally: // UPDATED $stateProvider .state(‘schedules’, { url: “/schedules/:day/:month/:year”, templateUrl: ‘schedules.html’, abstract: true, // make this abstract controller: function($scope, $state, $stateParams) { $scope.schedDate = moment($stateParams.year + ‘-‘ + $stateParams.month + ‘-‘ + $stateParams.day); $scope.isEdit = false; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)