angularjs - Not able to change the location path -
redirecting not functional in below code. console.log()
works fine, url doesn't change. needless say, i'm confused why. i've changed url section of application , works great.
angular.module('workstation.process.approval', [ /* dependencies */ 'workstation.services' ]). config(['$routeprovider', function($routeprovider) { /* url mappings */ $routeprovider. when('/approval', {templateurl: 'partials/loading.htm', controller: 'approvalctrl'}). when('/approval/dashboard', {templateurl: 'partials/approval/dashboard.htm', controller: 'approvalctrl'}) }]). controller('approvalctrl', ['$scope', '$cookiestore', 'workflowprocessservice', 'socketurl', '$location', function ($scope, $cookiestore, workflowprocessservice, socketurl, $location) { var socket = portal.open(socketurl+'/socket/workstation/approval'); socket.on({ open: function () { this.send('getdashboard', { workstationuuid: $cookiestore.get('workstationuuid') }, function(r) { $scope.dashboard = r; console.log('swap-path', r); $location.path('/approval/dashboard'); //not working }); }, close: function (reason) { console.log(reason); } }); }]);
try adding $scope.$apply() after change path. socket on callback called outside angular, may need tell angular run digest cycle notice change. – mark rajcok may 14 @ 21:18
it works me thanks
Comments
Post a Comment