import { IMineMeldAPIService } from '../../app/services/minemeldapi' ; ngInject export class LoginController { username : string ; password : string ; checking : boolean = false ; toastr : any ; $state : angular . ui . IStateService ; MineMeldAPIService : IMineMeldAPIService ; constructor ( $state , MineMeldAPIService , toastr ) { this . toastr = toastr ; this . $state = $state ; this . MineMeldAPIService = MineMeldAPIService ; } public submit ( ) { this . checking = true ; this . MineMeldAPIService . logIn ( this . username , this . password ) . then ( ( result ) => { this . checking = false ; this . $state . go ( 'dashboard' ) ; } , ( error ) => { this . checking = false ; this . toastr . error ( 'ERROR CHECKING CREDENTIALS: ' + error . statusText ) ; this . password = '' ; } ) ; } }