FAQ Database Discussion Community


Using angular ui.router how to start in a standard html angular page and than move forward to one with ui.router template inside a folder?

angularjs,angular-ui-router,angularjs-ui-router
I have a standard angular page that is not associated with any ui.router functionality(index.html). From that page I click a link that triggers an angular call and than after some operation the flow needs to be redirected to a page inside a folder that is using angular-ui.route template. I have...

$StateProvider Remove Child View Nesting

angularjs,routing,angular-ui-router,angularjs-ui-router
I am new to angular ui routing . I am creating a sample application and want to display parent and child view separately . I mean when parent item gets selected child view will be displayed and parent view would be hidden . If I add ui-view to parent view...

Angular - $state.go not redirecting as expected when user is not logged in

angularjs,angular-ui-router,angularjs-routing,angularjs-ui-router
I'm trying to redirect the user to the login page if the user is not logged in. The only use case that I can't get to work is if the user points the browser to a URL that requires authentication. If the user goes directly to http://.../index.html#/dashboard (requires authentication), the...

Inconsistent local storage values across views angularjs

angularjs,local-storage,angular-ui-router,angularjs-ui-router
I'm building an app in angularjs. My backend uses tokens to manage sessions. The token is sent on every request in the headers, and the response contains a header with a new token value that I should update. I'm using localStorage to store the token value. The problem I'm encountering...

Kendo Grid and ui-sref rounding up number

javascript,angularjs,asp.net-web-api,kendo-grid,angularjs-ui-router
I'm trying to do something relatively simple, but having an issue that is driving me mad, I'm sure I am missing something simple. I have an AngularJS site that's for the most part working fine, and in that I have a Kendo Grid. All I am trying to do is...

The href doesn't refresh when the ui-sref changes

javascript,angularjs,angularjs-directive,angularjs-ui-router,interpolation-directive
I have an issue with angular. I have this code in my template : <select class="form-control" ng-model="hiveReports.reportSelected" ng-options="link for link in hiveReports.reportsLink" ui-sref="dashboard.hive-reports.{{hiveReports.reportSelected}}"> </select> and the code behind like this : .config(['$stateProvider', function ($stateProvider) { $stateProvider .state('dashboard.hive-reports', { url: '/hive-reports', template: require('./hiveReports.tmpl.html'), abstract: true, controller: 'HiveReportsCtrl as hiveReports' }); }])...

Parse query then state change after resolve

angularjs,parse.com,angularjs-factory,angularjs-ui-router,angularjs-promise
I have a factory defined to make a parse call that resolves upon completion. .factory('currentRestaurantService', ['$rootScope', '$q', function($scope, $q) { return { getCurrentRestaurant: function() { var defer = $q.defer(); // Create a deferring object $scope.currentUser = Parse.User.current(); // Get restaurant for user var restaurantObject = Parse.Object.extend("Restaurant"); var query = new...

UI-Router routing in the same view (View and Edit)

javascript,angularjs,angular-ui-router,angularjs-ui-router
I'm not able to change the state from view page to edit page and vice versa in UI-Router. Things I've tried: Controller: $stateProvider .state('showViewA', { views: { " ": { template: "default.html", controller:"DefaultController.ts" }, "[email protected]": { template: "viewPage.html", controller:"DefaultController.ts" } } }) .state('[email protected]', { views: { " ": { template:...

AngularJS UI-Router: Two way binding between resolved object in child/parent state—Child state won't update

javascript,angularjs,angular-ui-router,angularjs-ui-router
I have a parent state and a child state. The parent state resolves an object. Then, the child state resolves that object from the parent state. Because the child state is resolving the object from the parent state, I would expect two-way binding to occur. And oddly, although changes from...

How to stop $interval on leaving ui-state?

angularjs,intervals,angularjs-ui-router
Angular, UI-router. Using $interval in a controller of a state like so: $scope.Timer = null; $scope.startTimer = function () { $scope.Timer = $interval($scope.Foo, 30000); }; $scope.stopTimer = function () { if (angular.isDefined($scope.Timer)) { $interval.cancel($scope.Timer); } }; The problem? The timer persists upon leaving the state. My understanding was that the...

Angularjs ui-router abstract state not invoking controller

javascript,angularjs,angular-ui-router,angularjs-ui-router
I am new to UI-Router and am struggling to get my controller invoked. I am using an abstract state as the parent and it does not seem to call the controller. Below is a simplified version of my code. I binded $stateChangeError onto the console and am not getting an...

ui-router without executing controller on every route change

angularjs,angular-ui-router,angularjs-ui-router
Ui-router sample configuration: header: { templateUrl: 'header.tpl', controller: 'HeaderCtrl' }, sidebar: { templateUrl: 'sidebar.tpl', controller: 'SidebarCtrl' }, main: { templateUrl: 'main.tpl' } The website starts with a login page which only has a main view. All the other pages in the app require authentication. Problem: Every time I open a...

How to call function in controller in angularjs?

angularjs,angularjs-scope,angularjs-controller,angularjs-ui-router
If in url parameter id is available then i want to call function. .controller('repeatCtrl', function($scope,$state,$stateParams) { if($stateParams.id != ""){ //Here i want to call itemDetails function $scope.itemDetails(id); }; $scope.itemDetails = function(id) { // function body here!! alert(id); }; }) ...

$state.go inside $stateChangeStart in app.run not working

javascript,angularjs,angular-ui-router,angularjs-ui-router
NOTE: this is a sample code, the window.has_redirected is just to make the question easier. This code won't redirect to dashboard. I've read online that the reason why it does't work is that $state is not ready yet.. however I'm seeing tutorials online that are doing something very similar to...

AngularJS $state does not change view

javascript,angularjs,angularjs-ui-router
In my AngularJS application in run() function I want to send user to signin page if they are not logged in. Here is code: .run(['$state', function($state) { $state.go('signin') .then(function(promise){}, function(reject) { console.log(reject) } ); }]); In console I get following: Error: transition superseded {stack: (...), message: "transition superseded"} Neither $state.transitionTo('signin')...