import { Component } from '@angular/core' ; import { NgForm } from '@angular/forms' ; import { Router } from '@angular/router' ; import { UserData } from '../../providers/user-data' ; import { UserOptions } from '../../interfaces/user-options' ; @ Component ( { selector : 'page-signup' , templateUrl : 'signup.html' , styleUrls : [ './signup.scss' ] , } ) export class SignupPage { signup : UserOptions = { username : '' , password : '' } ; submitted = false ; constructor ( public router , public userData ) { } onSignup ( form ) { this . submitted = true ; if ( form . valid ) { this . userData . signup ( this . signup . username ) ; this . router . navigateByUrl ( '/app/tabs/schedule' ) ; } } }