繁体   English   中英

如何在Hot Towel模板中使用gridstack-angular.js

[英]How to use gridstack-angular.js with Hot Towel Template

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

我已经使用bower来加载依赖项,并在core.module.js中添加了“ gridstack-angular”。 这是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控制器。 <p>和第一个<div>元素加载正常。 是的,在index.html中按预期引用了include。 Chrome给我一个“ t.gridstack无法运行”的信息。 看来gridstack-angular使用2个控制器和一个指令作为gridstack.js的包装器,而且我一直在尝试将角度的语法烘焙到Hot Towel中。

逐一逐句...在角度之前需要包含jquery和jquery-ui,如本文中所示: 源文件的控制顺序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM