首次ng后的角度停止 - 包括在释放模式中

时间:2014-11-26 17:39:14

标签: javascript angularjs gruntjs release-mode

我正在使用yeoman / generator-grunt-angular系统编译一个角度应用程序,我稍微修改了它以适应与另一个应用程序共享的代码。 "发布模式"正在将所有模板编译到javascript中,以便立即加载所有内容。如果我引用模板,就像这里:

<div ng-include="'components/navbar/navbar.html'" />
<div class="row">
  <div class="large-4 columns">
    <h3>Your Courses</h3>
    <div ng-include="'components/courses/course-list.html'" ng-controller="MyCoursesCtrl" />
    <form id="fileupload" 
          data-url="http://api.orienteer.io/upload_gpx"
          method="POST" enctype="multipart/form-data" 
          data-ng-controller="GpxFileUploadCtrl" 
          ng-submit="alert('gooo');">
      <span class="btn btn-success fileinput-button"  ng-class="{disabled: disabled}">
        <i class="glyphicon glyphicon-plus"></i>
        <span>Upload a GPX File</span>
        <input type="file" name="gpx_file" ng-disabled="disabled">
        {{ status }}
      </span>
    </form>
  </div>
</div>

模板在第一次包含之后停止。如果我删除第一个,它会在第二个之后停止。包含整个模板,但后面没有任何内容(在这种情况下,导航栏被渲染,但后面没有任何内容)。

不会抛出错误,模板都很乐意驻留在模板缓存中(事实证明它们出现,它们只是停止行为)。

开发模式下的代码没有问题,我完全不知道如何进一步调试它。有什么方法可以打开详细的日志记录,调试等?我已经完成了代码缩小,所以我可以阅读内容,但没有任何错误被抛出,我不知道从哪里开始。

修改 以下是我使用的所有依赖项的版本:

  "dependencies": {
    "modernizr": "2.8.x",
    "angular": "1.3.4",
    "jquery" : "1.x.x",
    "angular-animate" : "1.3.x",
    "angular-cookies" : "1.3.x",
    "angular-touch" : "1.3.x",
    "angular-sanitize" : "1.3.x",
    "angular-resource" : "1.3.x",
    "angular-ui-router" : "0.2.x",
    "angular-leaflet-directive" : "latest",
    "lodash" : "latest",
    "foundation" : "5.4.x",
    "jquery-file-upload" : "latest"
  },

2 个答案:

答案 0 :(得分:4)

我今天正在检查这个主题,我记得在W3Schools上使用了另一种表示法。

他们使用了:

<div ng-include="'myUsers_Form.htm'"></div>

而不是:

<div ng-include="'myUsers_Form.htm'" />

当我将第一个包含更改为您的样式时,我遇到了与该包含之后的包含相同的问题,但在W3Schools使用的表示法中,它可以包含多个文件。

答案 1 :(得分:0)

基于聊天:切换到更完整的UI路由器实现可能会解决与ng-include指令明显不兼容的问题。 https://github.com/angular-ui/ui-router