Skip to content

Instantly share code, notes, and snippets.

@ova2
Last active June 4, 2019 12:38
Show Gist options
  • Save ova2/2628eb83349e5be9624fd204ea56c9b6 to your computer and use it in GitHub Desktop.
Save ova2/2628eb83349e5be9624fd204ea56c9b6 to your computer and use it in GitHub Desktop.
@Component({
selector: 'app-identify-device',
template: `
...
<form (submit)="identifyDevice()" [formGroup]="formGroup">
<ion-item>
<ion-label color="dark" [position]="'stacked'">Track Number</ion-label>
<ion-input clearInput type="text" formControlName="trackNumber"></ion-input>
</ion-item>
</form>
...
`
})
export class IdentifyDevicePage implements OnInit {
public formGroup: FormGroup;
constructor(private _fb: FormBuilder, private _facade: CoreFacade) {
this.formGroup = this._fb.group({
trackNumber: ['', [Validators.required]]
});
}
public ngOnInit(): void {
this.formGroup.controls['trackNumber'].patchValue(this._facade.getTrackNumber());
}
public identifyDevice(): void {
this._facade.identifyDevice(this.mh.fcValue('trackNumber'))
.subscribe(success => success && this._router.navigateByUrl('device-identified'));
}
}
@mikehoh
Copy link

mikehoh commented Jun 4, 2019

What is this.mh.fcValue('trackNumber') ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment