应该在哪里插入属性gridster-item?

时间:2016-05-17 03:11:45

标签: javascript jquery html angularjs gridster

我尝试按以下方式插入gridster-item属性:

<div class="myTile" gridster-item= "tile" row="0" col="0" ng-repeat="tile in selectedTiles" > 
  <ul class="dropdown-menu">
     <li><a href="#"
                id="gridster-form"
                role="button"
                aria-labeledby="Gridster Layout Form">

                 <span class="dropdown-text">
                    Col <input type="text" value="tile.col" integer ng-model="tile.col" size="1" class="ng-scope ng-pristine ng-untouched ng-valid">
                    Row <input type="text" value="tile.row" integer ng-model="tile.row" size="1" class="ng-pristine ng-untouched ng-valid">     
                </span>
                <i class= "fa fa-arrows"></i>
    </a></li>
  </ul>
</div>

基本上当我放入gridster-item时,输入字段被tile.col和tile.row属性正确占用(没有它们就不显示)。

问题当我插入gridster-item属性时,它会将我的磁贴抛出到dom上的随机位置。这告诉我我没有正确使用它。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

尝试使用外部div并对其进行ng-repeat:

<div ng-repeat="tile in selectedTiles"> 
    <div class="myTile" gridster-item= "tile" row="0" col="0"  > 
      <ul class="dropdown-menu">
         <li><a href="#"
                    id="gridster-form"
                    role="button"
                    aria-labeledby="Gridster Layout Form">

                     <span class="dropdown-text">
                        Col <input type="text" value="tile.col" integer ng-model="tile.col" size="1" class="ng-scope ng-pristine ng-untouched ng-valid">
                        Row <input type="text" value="tile.row" integer ng-model="tile.row" size="1" class="ng-pristine ng-untouched ng-valid">     
                    </span>
                    <i class= "fa fa-arrows"></i>
        </a></li>
      </ul>
    </div>
</div>