首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在ng-switch中创建一个handsontable

在ng-switch中创建一个handsontable
EN

Stack Overflow用户
提问于 2017-01-05 18:59:32
回答 0查看 128关注 0票数 0

我想在ng-switch中使用一个手音表:当我们选择handsontable时,它会显示一个正常的、可编辑的手音表。

JSBin

HTML:

代码语言:javascript
复制
<!DOCTYPE html>
<html>
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
  <script src="https://docs.handsontable.com/pro/1.8.2/bower_components/handsontable-pro/dist/handsontable.full.min.js"></script>
  <link type="text/css" rel="stylesheet" href="https://docs.handsontable.com/pro/1.8.2/bower_components/handsontable-pro/dist/handsontable.full.min.css">
</head>
<body ng-app="">
  <select ng-model="myVar">
    <option value="dogs">Dogs
    <option value="handsontable">handsontable
  </select>

  <div ng-switch="myVar">
    <div ng-switch-when="dogs">
     <p>Welcome to a world of dogs.</p>
    </div>
    <div ng-switch-when="handsontable">
      <div id="example1" class="hot handsontable htRowHeaders htColumnHeaders"></div>
    </div>
  </div>
</body>
</html>

JavaScript:

代码语言:javascript
复制
var example1 = document.getElementById('example1');
var settings1 = { data: [['A1', 'B1'], ['A2', 'B2']] };
var hot1 = new Handsontable(example1, settings1);

this working example不同,表格中的单元格是不可编辑的。所以我想知道是不是遗漏了什么。例如,在工作示例中,表的创建是由document.addEventListener("DOMContentLoaded", function() { ... })包装的,我是否应该用某种东西包装此示例中的javascript代码,以确保只有在切换到handsontable之后才能创建表

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41483260

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档