Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.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
AngularJS错误:undefined不是使用ui.router的对象(计算k.childNodes)_Angularjs_Jsp_Angular Ui Router - Fatal编程技术网

AngularJS错误:undefined不是使用ui.router的对象(计算k.childNodes)

AngularJS错误:undefined不是使用ui.router的对象(计算k.childNodes),angularjs,jsp,angular-ui-router,Angularjs,Jsp,Angular Ui Router,我将()与JSP一起使用。我在main.jsp中有我的模板。JSP使用模板呈现,该模板具有使用JSTL c:foreach循环创建的表行。我的模板中有一个编辑和创建方法。当页面呈现时,我得到以下异常 Error: undefined is not an object (evaluating 'k.childNodes') g@../js/lib/vendor/angular.min.js:51:223 <div ui-view="" class="ng-scope"> 错误:un

我将()与JSP一起使用。我在main.jsp中有我的模板。JSP使用模板呈现,该模板具有使用JSTL c:foreach循环创建的表行。我的模板中有一个编辑和创建方法。当页面呈现时,我得到以下异常

Error: undefined is not an object (evaluating 'k.childNodes')
g@../js/lib/vendor/angular.min.js:51:223 
<div ui-view="" class="ng-scope">
错误:undefined不是对象(正在计算“k.childNodes”)
g@../js/lib/vendor/angular.min.js:51:223
jsp有如下模板和脚本。我在网上修改了一个例子。如果您查看route1.list.html,这正是我在main.jsp模板中看到的,只是我的模板是使用JSTL加载的。我在Angular团队也看到了类似的情况。我遗漏了什么吗。但一旦我从SPAN元素中删除ng click,我就看不到错误

<div class="content">
   <div ui-view></div>
</div>

<!-- Templates below -->
<script id="ports.html" type="text/ng-template">
<div>
 <button name="create" value="create" ng-click="createPort()">test</button>
 <table>
  <thead>
    <tr>
        <th>Name</th>
        <th>Port</th>
    </tr>
  </thead>
  <tbody>
    <c:forEach items="${MyForm.portsList}" var="port">
        <tr>
            <td>${port.name} <p>${port.description}</p></td>
            <td><span ng-click="editPort()">${port.id}</span></td>
        </tr>
    </c:forEach>
  </tbody>
 </table>
</div>
</script>
<script>
  var app = angular.module('MyApp',["ui.router","ui.bootstrap"]);
  app.config(function($stateProvider, $urlRouterProvider){
   $stateProvider
    .state('ports', {
        url: "/ports",
        templateUrl: "ports.html",
        controller: PortsCtrl
      })

    $urlRouterProvider.otherwise("/ports")
  })

  function PortsCtrl($scope){
    $scope.editPort = function(){
        console.log("Show ports clicked!);
    } 
    $scope.createPort = function(){
        console.log("Show ports clicked!);
    } 
 }
</script>

测试
名称
港口
${port.name}${port.description}

${port.id} var-app=angular.module('MyApp',[“ui.router”,“ui.bootstrap]”); app.config(函数($stateProvider,$urlRouterProvider){ $stateProvider .州(“港口”{ url:“/ports”, templateUrl:“ports.html”, 控制器:PortsCtrl }) $urlRouterProvider。否则(“/ports”) }) 函数PortsCtrl($scope){ $scope.editPort=函数(){ log(“显示已单击的端口!); } $scope.createPort=function(){ log(“显示已单击的端口!); } }
刚刚遇到这个问题,
所以我比较了你的代码和我的代码

在我看来,这样做的原因是HTML注释。
所以只需删除此

我很高兴知道这对你是否有用