angular-route-segment icon indicating copy to clipboard operation
angular-route-segment copied to clipboard

change from function controller to module controller problem

Open MingyaoLiu opened this issue 11 years ago • 1 comments

Hi, I'm fairly new to this lib, and in app.js I was trying to change from:

function MainCtrl($scope, $routeSegment, loader) { $scope.$routeSegment = $routeSegment; $scope.loader = loader; $scope.$on('routeSegmentChange', function() { loader.show = false; }) }

to:

app.controller('MainCtrl', ['$scope', '$routeSegment', 'loader', function($scope, $routeSegment, loader) { $scope.$routeSegment = $routeSegment; $scope.loader = loader; $scope.$on('routeSegmentChange', function() { loader.show = false; }) }]);

however, it doesn't seems working, can you help me look at the code and tell me where I did wrong? I've been googling and looking at documentations but no luck... Thanks!

MingyaoLiu avatar Apr 17 '14 17:04 MingyaoLiu

Have you tried $scope.$apply() yet?

airtonix avatar May 26 '14 10:05 airtonix