I'm migrating my angular app to typescript. I've got following ts code:
/// <reference path="../../../typings/tsd.d.ts" />
class UiRoutingHelper {
constructor(public $state: any) {};
reloadCurrentView() {
return this.$state.go(this.$state.current.name, this.$state.params, {
reload: true
});
};
}
mp.core.CoreModule.factory('UiRoutingHelper', ['$state', UiRoutingHelper]);
which does compiles correctly. The whole application build process builds correctly as well. But in the runtime I get following error:
Error: [$injector:undef] Provider 'UiRoutingHelper' must return a value from $get factory method.
http://errors.angularjs.org/1.3.15/$injector/undef?p0=UiRoutingHelper
at angular.js:63
at Object.enforcedReturnValue [as $get] (angular.js:4058)
at Object.invoke (angular.js:4203)
at angular.js:4021
at getService (angular.js:4162)
at Object.invoke (angular.js:4194)
at extend.instance (angular.js:8493)
at angular.js:7739
at forEach (angular.js:331)
at nodeLinkFn (angular.js:7738)
Please advice me on what am I doing wrong.
typings//tsd.d.ts is just a bootstrap file, which loads some predefined interfaces. mp.core.CoreModule has been declared before (it's available for TypeScript).