Javascript 按钮ng的替代选择点击angularjs

Javascript 按钮ng的替代选择点击angularjs,javascript,java,angularjs,spring,internet-explorer-11,Javascript,Java,Angularjs,Spring,Internet Explorer 11,我正在开发angularjs应用程序。我在我的主页上有一个按钮,当用户点击该按钮时,它必须点击控制器并从后端获取数据并显示在浏览器上。在chrome和firefox中一切都很好,但在IE中却不起作用。努力寻找替代解决方案,但运气不佳,任何建议都会有所帮助 spring controller: @RequestMapping(value = "/getData", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_V

我正在开发angularjs应用程序。我在我的主页上有一个按钮,当用户点击该按钮时,它必须点击控制器并从后端获取数据并显示在浏览器上。在chrome和firefox中一切都很好,但在IE中却不起作用。努力寻找替代解决方案,但运气不佳,任何建议都会有所帮助

spring controller:

@RequestMapping(value = "/getData", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody
    List<String> getMyData(HttpServletRequest request) throws Exception {
        System.out.println("In MyDataController"); //printed only when navigated through chrome
    //logic here
    //return statement
}
html: 登录

spring controller:

@RequestMapping(value = "/getData", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody
    List<String> getMyData(HttpServletRequest request) throws Exception {
        System.out.println("In MyDataController"); //printed only when navigated through chrome
    //logic here
    //return statement
}

在IE11中,当我单击按钮时,只会显示控制器中的警报btnAdminDetail、js控制器,其他警报语句或console.log语句不会被打印。

没有ngClick的替代方法,但您也可以使用NGDBLCICK代替ngClick。有关更多详细信息,请参阅此链接:

spring controller:

@RequestMapping(value = "/getData", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody
    List<String> getMyData(HttpServletRequest request) throws Exception {
        System.out.println("In MyDataController"); //printed only when navigated through chrome
    //logic here
    //return statement
}

在按钮标签中添加值

spring controller:

@RequestMapping(value = "/getData", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody
    List<String> getMyData(HttpServletRequest request) throws Exception {
        System.out.println("In MyDataController"); //printed only when navigated through chrome
    //logic here
    //return statement
}
<div ng-controller="myController">
    <button type="submit" class="btn btn-default" value="login" ng-
     click="btnAdminDetails()">
       Login
    </button>
</div>

我认为您的应用程序在IE11中不起作用。所以请执行以下更改

spring controller:

@RequestMapping(value = "/getData", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody
    List<String> getMyData(HttpServletRequest request) throws Exception {
        System.out.println("In MyDataController"); //printed only when navigated through chrome
    //logic here
    //return statement
}
1.在head tag中添加以下行

spring controller:

@RequestMapping(value = "/getData", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody
    List<String> getMyData(HttpServletRequest request) throws Exception {
        System.out.println("In MyDataController"); //printed only when navigated through chrome
    //logic here
    //return statement
}
<meta http-equiv="X-UA-Compatible" content="IE=11" />
3.更改关于IE11的web.config文件

spring controller:

@RequestMapping(value = "/getData", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody
    List<String> getMyData(HttpServletRequest request) throws Exception {
        System.out.println("In MyDataController"); //printed only when navigated through chrome
    //logic here
    //return statement
}
 <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <clear />
        <add name="X-UA-Compatible" value="IE=11" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration> 

你们能告诉我,点击按钮,btnAdminDetails功能正在运行吗?是否?是的,它正在运行并调用angular控制器,问题是它没有击中spring控制器。请向我们展示您的MyService代码。请使用IE开发工具检查是否有任何错误记录到控制台。@WasifKhan-请参阅我上面的帖子,我已经添加了一些详细信息和服务调用。IE控制台中未显示任何错误。但我注意到的一件事是,当开发者工具在IE中打开时,行为是正确的,它也会影响到spring控制器。我的问题不是一个替代方案,而是应该在IE中工作,显然我不能使用ngDblClick,因为我不能告诉用户双击以获得功能,而不是单击按钮。对我上述相关帖子的任何建议都会有帮助。@Mayank SharmaI已经尝试过添加这些内容,但没有成功。我现在正在用我的最新版本编辑我的文章。请看一下您正在使用的IE版本是什么11是该版本,控制台中没有显示任何错误@维卡什库马