2017-03-27 152 views
0

我正在使用Angular2,并且当用户使用Windows 7上的IE11访问我的页面(这似乎是唯一有问题的组合)时,他们无法将信息输入到textboxes/textareas中。下拉式工作就像复选框一样正常(虽然您仍然无法将信息输入到新的文本字段中,但会根据需要显示/隐藏其他字段)。Angular2无法将文本输入到输入字段

如果用户点击提交按钮,所有必填字段显示为需要输入,然后用户可以输入信息。

如果有要求,用户在输入RECAPTCHA信息后重定向到此页面。如果我从我的应用程序路由模块中取出“canActivate”,它将起作用。

这里是图形验证码

import { Component } from '@angular/core'; 
import { 
    Router, 
    NavigationExtras 
} from '@angular/router'; 
import { CaptchaService } from '../../utils/captchaguard/captcha.service'; 
import { ReCaptchaComponent } from 'angular2-recaptcha/lib/captcha.component'; 

@Component({ 
    moduleId: module.id, 
    templateUrl: 'captcha.component.html' 
}) 

export class CaptchaComponent { 
    message: string; 

    constructor(
     public captchaService: CaptchaService, 
     public router: Router) { 
     //this.captchaService.isLoggedIn = true; //Uncomment out for testing 
     this.captchaService.isLoggedIn = false;  //Uncomment out for live 
    } 

    handleCorrectCaptcha(userResponseKey: any) { 
     let redirect = this.captchaService.redirectUrl ? this.captchaService.redirectUrl : '/admin'; 
     let redirectParts = redirect.split('/'); 
     let appendID = redirect[redirect.length - 1]; 
     //let appendID = 0; 
     this.captchaService.isLoggedIn = true; 
     //this.router.navigate(['/studyfd' + appendID]); 
     this.router.navigateByUrl('/studyfd' + appendID); 
     //this.router.navigate(['/studytest/0']); 
    } 
} 

这里是有问题生成页面的HTML的一部分:

<!-- First and Last Name --> 
       <div class="row"> 
        <div class="col-sm-6"> 
         First Name, Last Name 
        </div> 
        <div class="col-sm-3"> 
         <input type="text" name="FirstName" id="firstname" required="required" 
           placeholder="First Name" class="required " 
           [(ngModel)]="user.FirstName" *ngIf="!readonly" /> 
         <label *ngIf="readonly">{{user.FirstName}}</label> 
        </div> 
        <div class="col-sm-3"> 
         <input type="text" name="LastName" id="lastName" required="required" 
           placeholder="Last Name" [(ngModel)]="user.LastName" *ngIf="!readonly" 
           class="required " /> 
         <label *ngIf="readonly">{{user.LastName}}</label> 
        </div> 
       </div> 
+2

代码是什么样的? –

+0

请提供更多的源代码信息,以便我们可以帮助您 –

+0

条目更新了一些使用的代码。如果您认为其他代码会有用,请告诉我。引用的Captcha.service只用于存储redirectUrl变量。我再次测试了Windows 8,Windows 10和Mac OS 10,以及Windows 7上的Chrome和Firefox,并且它只有Windows 7和IE11存在问题。谢谢你的帮助 –

回答

0

原来,问题的ReCaptcha窗口不关闭是由于(可能是因为我在handleCorrectCaptcha中做的重定向)。通过添加一个隐藏的按钮解决,并在handleCorrectCaptcha方法中,我使按钮可见。点击按钮执行最初在handleCorrectCaptcha方法中完成的重定向。

相关问题