1
1
import { Component } from '@angular/core' ;
2
2
< % _ if ( filters . uirouter ) { - % >
3
3
import { StateService } from 'ui-router-ng2' ; < % } % >
4
- < % _ if ( filters . ngroute ) { - % > < % } % >
4
+ < % _ if ( filters . ngroute ) { - % >
5
+ import { Router } from '@angular/router' ; < % } % >
5
6
import { AuthService } from '../../../components/auth/auth.service';
6
7
7
8
// @flow
@@ -37,10 +38,11 @@ export class LoginComponent {
37
38
< % _ if ( filters . uirouter ) { - % >
38
39
StateService;< % } % >
39
40
40
- static parameters = [ AuthService , < % if ( filters . ngroute ) { % > < % } else { % > StateService < % } % > ] ;
41
- constructor ( _AuthService_ : AuthService , < % if ( filters . ngroute ) { % > < % } else { % > _StateService_ : StateService < % } % > ) {
41
+ static parameters = [AuthService, < % if ( filters . ngroute ) { % > Router < % } else { % > StateService < % } %> ] ;
42
+ constructor ( _AuthService_ : AuthService , < % if ( filters . ngroute ) { % > router: Router < % } else { % > _StateService_ : StateService < % } %> ) {
42
43
this . AuthService = _AuthService_ ;
43
- < % _ if ( filters . ngroute ) { - % > < % } % >
44
+ < % _ if ( filters . ngroute ) { - % >
45
+ this . Router = router ; < % } %>
44
46
< % _ if ( filters . uirouter ) { - % >
45
47
this.StateService = _StateService_;< % } % >
46
48
}
@@ -54,7 +56,10 @@ export class LoginComponent {
54
56
} )
55
57
. then ( ( ) => {
56
58
// Logged in, redirect to home
57
- this . StateService . go ( 'main' ) ;
59
+ < % _ if ( filters . ngroute ) { - % >
60
+ this . Router . navigateByUrl ( '/home' ) ; < % } % >
61
+ < % _ if ( filters . uirouter ) { - % >
62
+ this . StateService . go ( 'main' ) ; < % } % >
58
63
} )
59
64
. catch ( err => {
60
65
this . errors . login = err . message ;
0 commit comments