I am new to Angular 2.
We have 2 forms in HTML with separate div tags, each time the 1st div is executed, the second div is a false state. Whenever success causes the second, the div will be true. Whenever the second state div true occurs, it displays this error message .
Below is my .ts file code:
constructor(public navCtrl: NavController, public navParams: NavParams, public formBuilder:FormBuilder, public logger: Logger, public rest: Rest ) { this.customer_id=this.navParams.get('customer_id'); this.mobile=this.navParams.get('mobile'); this.myForm = formBuilder.group({ 'otpNumber': ['', Validators.required] //'password': ['', Validators.required] }); this.myForm1 = formBuilder.group({ 'newpassword': ['', Validators.required], 'conformPassword': ['', Validators.required] }); this.getotp(); } submit(){ let validateOTPObj = { loginId: this.mobile, otp:this.myForm.value.otpNumber } this.logger.debug("checking the otpNumber"+JSON.stringify(validateOTPObj)); this.rest.post('/validateOTP' ,validateOTPObj) .subscribe((result)=>{ this.logger.debug("checking data of success " + JSON.stringify(result)); if(result.status=='1'){ //this.navCtrl.push(,{}); //this.access_token = id; this.firstDiv=false; this.secondDiv = true; this.logger.debug("checking access tocken "+ this.access_token); alert("otp success"); } else { this.logger.info("error"); } }); }
source share