Reputation: 6653
The location does update when I change state with ui-sref
, what it does do tho Is display the correct view and controller and the params are accessible from that controller.
my app.js looks like this:
/**
* @ngdoc overview
* @name adminPanelAngularApp
* @description
* # adminPanelAngularApp
*
* Main module of the application.
*/
angular
.module('adminPanelAngularApp', [
'ngCookies',
'ngResource',
'restangular',
'ngRoute',
'ngSanitize',
'ngTouch',
'nouislider',
'blockUI',
'ui.router',
'ui.bootstrap',
'environmentFilters',
'ui.select2',
'angular-ladda',
'angular.filter'
])
.run(['$rootScope', '$state', '$stateParams', function($rootScope, $state, $stateParams){
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
$rootScope.environment = {};
$rootScope.new_environments = []
$rootScope.new_nodes = [];
}]).config(function($stateProvider, $urlRouterProvider, RestangularProvider) {
RestangularProvider.setBaseUrl('http://localhost:3000');
// For any unmatched url, redirect to /404
$urlRouterProvider.otherwise('/404');
//
// Now set up the states
$stateProvider
.state('environment/show', {
url: "env/{appid}",
views: {
"top": {templateUrl: "views/environment/show.html", controller: 'EnvironmentCtrl'},
"bottom": {templateUrl: "views/environment/nodes.html"}
}
})
});
this is the link that I use:
ui-sref="environment/show({appid: nv.env.appid})"
Basically like this everything works except for it showing the url correctly in the location bar.
Upvotes: 1
Views: 403
Reputation: 6653
I fixed it by following the advice in this issue
https://github.com/McNull/angular-block-ui/issues/40#issuecomment-64742130
$scope.$on('$locationChangeStart', function (event) {
if (srvInstance.state().blockCount > 0) {
//event.preventDefault();
}
});
It was stopping ui-router from doing it's thing.
I could have also disabled automatic ui-blocking also like so:
blockUIConfig.autoBlock = false;
Upvotes: 2