After this line of code runs
cockpit.controller('shell', shellCtrl);
in my main module, the shell controller is registered with the angular application's _invokeQueue, but the code in the shellCtrl's constructor never fires. Why wouldn't it?
Here is the TypeScript for shellCtrl
module cockpit {
'use strict';
export class shellCtrl {
public static $inject = [
'$location', '$rootScope', '$scope',
'localize'
];
public userId = 0;
constructor($location, $rootScope, $scope, localize) {
$scope.vm = this;
$rootScope.$on('localizeResourcesUpdated', function () {
$rootScope.title = localize.getLocalizedString('_appTitle_');
});
//If the userid is null go to login
if (this.userId == 0) {
$location.path('/login');
}
}
}
}
shellCtrl
is only available with the scope ofcockpit
or directly:cockpit.shellCtrl
. – WiredPrairie Feb 3 '14 at 0:38