I am new to typescript and am trying to use UI Router's $state
to navigate in my typescript controller. Unfortunately, I am still receiving a state is not defined
error that I cannot resolve.
Here is my controller:
module MyApp {
export class LoginController {
email: string;
password: string;
loginForm: any;
state: any;
constructor($state: ng.ui.IStateProvider) {
this.state = $state;
};
login() {
if (this.loginForm.$invalid) {
return;
}
console.log(`Login was clicked, email is ${this.email} and password is ${this.password}`);
state.go('Dashboard');
}
}
}
angular.module('myApp').controller('loginController', MyApp.LoginController);
Any help would be appreciated.
Angular 1.5
– cfly24 Feb 16 at 16:42