I am trying to execute two if blocks one after the other.Both the if blocks consist of a service. But the condition for the second if block depends on a flag being set to true in the first if block.I know this is a little confusing but please take a look at the code below for a better understanding
submit(){
condition1=false;
if(somecondition){
if(condition1= false){
this.service.confirm({
message: Do you want to proceed?
confirm.accept(){
//reditect to other page
}
confirm.reject(){
condition1=true;
}
})
}
if(condition1 = true){
this.service.confirm({
message: Do you want to quit?
})
}
}
}
So basically what is happening here is on clicking the SUBMIT button ,a confirm dialog box appears, this box will display different messages depending on the condition. If condition one is false then the dialog box displays the first message.If we click on YES on the dialog box then accept() is called , if we click on NO then reject() is called and there in reject() the condition1 is set to true.As soon as this condition is set to true we want the current dialog box to close(which is, that we want to come out of the service)and immediately reappear again with the second message in it(that is the second if condition is executed and the same service with a different message is called).How can I achieve this?
Aucun commentaire:
Enregistrer un commentaire