我是Angular 2的新手.
我们在HTML中有2个表单,带有单独的div标签,每当第一个div执行时,第二个div就是假状态.每当成功回调第二个div就会成为真状态.每当它进入第二个div真状态时它将显示this error message.
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"); } }); }