【问题标题】:How to use gridstack-angular.js with Hot Towel Template如何使用带有热毛巾模板的 gridstack-angular.js
【发布时间】:2016-07-19 20:02:17
【问题描述】:

我正在使用热毛巾模板,并且正在尝试使用 gridstack-angular 包。我基本上是在尝试将演示功能添加到 my-page.controller.js、my-page.route.js 和 my-page.html 中。

我使用 bower 加载依赖项并将“gridstack-angular”添加到 core.module.js。这是 my-page.html 中出现问题的地方:

<section id="my-page-view" class="content">
<section class="matter">
    <div container-fluid>
        <h1>gridstack-angular demo</h1>
        <p>{{vm.widgets}}</p>
        <div>
            <a class="btn btn-primary" ng-click="vm.addWidget()" href="#">Add Widget</a>
        </div>
        <br>
        <div class="row">
            <div class="col-md-12">
                <div gridstack class="grid-stack grid1" options="vm.options" on-change="vm.onChange(event,items)" on-drag-start="vm.onDragStart(event,ui)"
                     on-drag-stop="vm.onDragStop(event,ui)" on-resize-start="vm.onResizeStart(event,ui)" on-resize-stop="vm.onResizeStop(event,ui)">
                    <div gridstack-item ng-repeat="w in vm.widgets" class="grid-stack-item" gs-item-x="w.x" gs-item-y="w.y"
                         gs-item-width="w.width" gs-item-height="w.height" gs-item-autopos="1" on-item-added="vm.onItemAdded(item)" on-item-removed="vm.onItemRemoved(item)">
                        <div class="grid-stack-item-content">
                            <a class="btn btn-primary" ng-click="vm.removeWidget(w)" href="#">remove</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

检查浏览器显示该指令引用于:

<div gridstack ...>

找不到它的 gridstack 控制器。 &lt;p&gt; 和第一个 &lt;div&gt; 元素加载正常。是的,包含在 index.html 中按预期引用。 Chrome 给了我一个 't.gridstack is not function'。看来 gridstack-angular 使用 2 个控制器和一个指令作为 gridstack.js 的包装器,我一直在试图将这些转换成 Hot Towel 的角度语法窒息。

【问题讨论】:

    标签: html angularjs hottowel


    【解决方案1】:

    逐点...需要在 angular 之前包含 jquery 和 jquery-ui,如本文所示:Control order of source files

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-20
      • 1970-01-01
      • 1970-01-01
      • 2014-06-08
      • 1970-01-01
      • 2013-02-21
      • 2013-03-25
      • 1970-01-01
      相关资源
      最近更新 更多