import { Component , OnInit } from '@angular/core' ; import { Router } from '@angular/router' ; import { FormDataService } from '../data/formData.service' ; @ Component ( { selector : 'mt-wizard-work' , templateUrl : './work.component.html' } ) export class WorkComponent implements OnInit { title = 'What do you do?' ; workType : string ; form : any ; constructor ( private router , private formDataService ) { } ngOnInit ( ) { this . workType = this . formDataService . getWork ( ) ; console . log ( 'Work feature loaded!' ) ; } save ( form ) { if ( ! form . valid ) { return false ; } this . formDataService . setWork ( this . workType ) ; return true ; } goToPrevious ( form ) { if ( this . save ( form ) ) { this . router . navigate ( [ '/personal' ] ) ; } } goToNext ( form ) { if ( this . save ( form ) ) { this . router . navigate ( [ '/address' ] ) ; } } }