Trying to write a ui.router in typescript for the first time. as of now my code looks like this:
class Configuration {
constructor(private $stateProvider: ng.ui.IStateProvider,
private $urlRouterProvider: ng.ui.IUrlRouterProvider) {
this.init();
}
private init(): void {
this.$stateProvider.state("main", Configuration.defaultState());
this.$stateProvider.state("login", Configuration.login());
this.$urlRouterProvider.otherwise('/main');
}
private static defaultState(): ng.ui.IState {
return {
url: "/main"
, template: "<h1>hello</h1>"
}
}
private static login(): ng.ui.IState {
return {
url: "/login"
, template: "login"
}
}
}
angular.module('smm')
.config(($stateProvider: ng.ui.IStateProvider,
$urlRouterProvider: ng.ui.IUrlRouterProvider) => {
return new Configuration($stateProvider, $urlRouterProvider)
});
As much as the compile code looks all right, the router does not seem to work, I have no error in the console nor any route is executed. I guess the problem is silly but I can't seem to find it. Any idea?