Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Angularjs模式在spring mvc中工作不正常_Javascript_Jquery_Angularjs_Spring Mvc_Bootstrap Modal - Fatal编程技术网

Javascript Angularjs模式在spring mvc中工作不正常

Javascript Angularjs模式在spring mvc中工作不正常,javascript,jquery,angularjs,spring-mvc,bootstrap-modal,Javascript,Jquery,Angularjs,Spring Mvc,Bootstrap Modal,我已经有了这些依赖项,我想包括模态功能 var studentProfile = angular.module('studentProfile', ["xeditable"]) // .config(function( $httpProvider){ // $httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest'; //}) ; studentProfile.r

我已经有了这些依赖项,我想包括模态功能

var studentProfile = angular.module('studentProfile', ["xeditable"])

   // .config(function( $httpProvider){
    //  $httpProvider.defaults.headers.common["X-Requested-With"] =    'XMLHttpRequest';
    //})    ;

studentProfile.run(function(editableOptions) {
      editableOptions.theme = 'bs3';
    });

studentProfile.controller("studentProfileController", function($scope, $http, $timeout, $filter) {
//
// My studentProfileController methods
我试过了,但即使是最简单的一个也不行。模态在另一个页面中非常有效,但当我将它包含在这个页面中时,它就不起作用了

<script src="${pageContext.servletContext.contextPath}/resources/js/myModel.js"></script>


成功
去除
否认
取消
是否有其他数据/按钮
jsp页面

<div ng-app="mymodal" ng-controller="MainCtrl" class="container">
  <button ng-click="toggleModal('Success')" class="btn btn-default">Success</button>
  <button ng-click="toggleModal('Remove')" class="btn btn-default">Remove</button>
  <button ng-click="toggleModal('Deny')" class="btn btn-default">Deny</button>
  <button ng-click="toggleModal('Cancel')" class="btn btn-default">Cancel</button>
  <modal visible="showModal">
      Any additional data / buttons
  </modal>
</div>

成功
去除
否认
取消
是否有其他数据/按钮
上面的示例单独运行良好。请告诉我如何使用上面的app.controller(studentProfile)进行同样的操作。因为当我包含模态功能时,我的可编辑表单停止工作


我还有一个问题。当我将studentProfile应用程序放在单独的.js文件中并将其包含在jsp页面中时,它的功能不起作用。知道为什么吗?基本的jsp页面结构与之相同,可编辑元素可以工作,但当单击按钮时甚至不工作。

AngularJS是一个客户端框架。您的问题和问题定义在JSP和服务器端工作的上下文中太多,以至于很难理解。我建议不要在应用程序中混合使用JSP和AngularJS。AngularJS最适合小型/大型单页应用程序。但是,在这种情况下,我建议您发布已经在浏览器上呈现的页面片段。调查那里的问题。使用Chrome浏览器开发工具。如果您想要快速响应/帮助-创建一个plnkr。我只想在弹出窗口中显示一个简单的页面,其中包含通过ajax从服务器传输的数据。我使用angularjs实现我所有的ajax目的。在大型网站上使用angularjs,至少在使用Ajax的情况下是不合适的。您提到“它在这个页面上工作,而不是在其他页面上”。如果你有一个以上的页面,那么它是一个单页面应用程序。您是否在控制台中看到任何错误?它不是单页应用程序。只需使用ajax和其他angularjs函数。所以我不应该使用angularjs,如果我有多页的项目?
<div ng-app="mymodal" ng-controller="MainCtrl" class="container">
  <button ng-click="toggleModal('Success')" class="btn btn-default">Success</button>
  <button ng-click="toggleModal('Remove')" class="btn btn-default">Remove</button>
  <button ng-click="toggleModal('Deny')" class="btn btn-default">Deny</button>
  <button ng-click="toggleModal('Cancel')" class="btn btn-default">Cancel</button>
  <modal visible="showModal">
      Any additional data / buttons
  </modal>
</div>