22import { Component } from '@angular/core' ;
33< % _ if ( filters . uirouter ) { - % >
44import { StateService } from 'ui-router-ng2' ; < % } % >
5- < % _ if ( filters . ngroute ) { - % > < % } % >
5+ < % _ if ( filters . ngroute ) { - % >
6+ import { Router } from '@angular/router' ; < % } % >
67import { AuthService } from '../../../components/auth/auth.service';
7- import { ANGULARCLASS_MATCH_CONTROL_DIRECTIVES } from '@angularclass/match-control' ;
88
99< % _ if ( filters . flow ) { - % >
1010type User = {
@@ -21,8 +21,7 @@ interface User {
2121
2222@Component({
2323 selector : 'signup' ,
24- template : require ( './signup.<%=templateExt%>' ) ,
25- directives : [ ...ANGULARCLASS_MATCH_CONTROL_DIRECTIVES ]
24+ template : require ( './signup.<%=templateExt%>' )
2625} )
2726export class SignupComponent {
2827 user : User = {
@@ -33,14 +32,16 @@ export class SignupComponent {
3332 errors = { } ;
3433 submitted = false ;
3534 AuthService ;
36- < % _ if ( filters . ngroute ) { - % > < % } %>
35+ < % _ if ( filters . ngroute ) { - % >
36+ Router ; < % } %>
3737 < % _ if ( filters . uirouter ) { - % >
3838 StateService;< % } % >
3939
40- static parameters = [AuthService, < % if ( filters . ngroute ) { % > < % } else { % > StateService < % } %> ] ;
41- constructor ( _AuthService_ : AuthService , < % if ( filters . ngroute ) { % > < % } else { % > _StateService_ : StateService < % } %> ) {
40+ static parameters = [AuthService, < % if ( filters . ngroute ) { % > Router < % } else { % > StateService < % } %> ] ;
41+ constructor ( _AuthService_ : AuthService , < % if ( filters . ngroute ) { % > router: Router < % } else { % > _StateService_ : StateService < % } %> ) {
4242 this . AuthService = _AuthService_ ;
43- < % _ if ( filters . ngroute ) { - % > < % } -%>
43+ < % _ if ( filters . ngroute ) { - % >
44+ this . Router = router ; < % } -%>
4445 < % _ if ( filters . uirouter ) { - % >
4546 this.StateService = _StateService_;< % } - % >
4647 }
@@ -55,7 +56,7 @@ export class SignupComponent {
5556 } )
5657 . then ( ( ) => {
5758 // Account created, redirect to home
58- < % if ( filters . ngroute ) { % > this . $location . path ( '/' ) ; < % } - % >
59+ < % if ( filters . ngroute ) { % > this . Router . navigateByUrl ( '/home ' ) ; < % } - % >
5960 < % if ( filters . uirouter ) { % > this . StateService . go ( 'main' ) ; < % } - % >
6061 } )
6162 . catch ( err => {
0 commit comments