| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1× 6× 4× 2× 2× 2× 1× 1× 1× 1× | class PhoneFormController {
constructor () {
this.allOS = ['Android', 'iOS', 'Windows Phone'];
}
submitForm (phone) {
if (this.phoneForm.$invalid || !this.phone.releaseDate) {
return;
}
this.isRequest = true;
// call submit method passed in from outer scope
this.submit({phone})
.then(() => {
this._endRequest();
this.phoneForm.$setPristine();
})
.catch(this._endRequest.bind(this));
}
_endRequest () {
this.isRequest = false;
}
}
PhoneFormController.$inject = [];
export default PhoneFormController;
|