0
ng-switch
の中にhandontableを使用したいと思います:handsontable
を選択すると、通常の編集可能な手持ち式が表示されます。ng-switchにhandontableを作成します
HTML:
<!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:this working exampleとは異なり
var example1 = document.getElementById('example1');
var settings1 = { data: [['A1', 'B1'], ['A2', 'B2']] };
var hot1 = new Handsontable(example1, settings1);
、テーブル内のセルは編集できません。だから、何かが欠落しているかどうか疑問に思っています。たとえば、実際の例では、テーブルの作成はdocument.addEventListener("DOMContentLoaded", function() { ... })
でラップされていますが、この例ではjavacriptコードを何かで囲んでhandsontable
に変更した後にテーブルを作成する必要がありますか?
[ 'ngHandsontable'](https://github.com/handsontable/ngHandsontable)に見てください。 – Mistalis