У меня есть компонент angular 2 для забытого пароля. Компонент запрашивает у сервера генерацию SMS-кода подтверждения и оповещает пользователя об отправке SMS-сообщения. После получения ответа службы отображается оповещение о том, что код доставлен на мобильный телефон пользователя с помощью *ngIf
.
Однако когда пользователь запрашивает второй код, предупреждение (ng2-bootstrap) не всплывает.
Любая помощь приветствуется.
@Component({
templateUrl:'forgot-password.component.html',
styleUrls:['../../res/styles/login.component.css'],
providers:[{provide:AlertConfig, useFactory:getAlertConfig}]
})
export class ForgotPasswordComponent implements OnInit{
model:any={};
returnUrl:string;
smsCodeResponse:SMSVerificationInfo;
errorMessage:string;
activeVerificationCodeSent:boolean;
constructor(
private route:ActivatedRoute,
private router:Router,
private authenticationService:AuthenticationService
){}
requestVerificationCode(){
this.authenticationService.requestSMSCode(this.model.username)
.subscribe(
(s)=>this.smsCodeResponse=s,
(e)=>this.errorMessage=e,
()=> {
this.activeVerificationCodeSent=this.smsCodeResponse.aktifmi)
};
}
}
шаблон
<div *ngIf="activeVerificationCodeSent">
<alert type="danger" dismissible="true">
<strong>Bilgi</strong> Doğrulama Kodu telefonunuza gonderildi.
</alert>
</div>