0
我正在使用angular-gantt庫,並在動態更改高度時遇到一些麻煩。當我在控制器中設置了maxHeight屬性的新值時,它對視圖沒有影響。我認爲,這樣的改變應該是可能的,因爲在演示應用程序中工作(Angular Gantt demo - 當點擊佈局 - >高度)。也許我錯過了什麼?欣賞任何線索。更改角甘特組件的maxHeight沒有任何作用
這裏是我的示例代碼:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="angular-gantt.css" />
<script src="angular.js"></script>
<script src="moment.js"></script>
<script src="angular-moment.js"></script>
<script src="angular-gantt.js"></script>
</head>
<body ng-app="myApp">
<script>
var myApp = angular.module('myApp', ['gantt']);
myApp.controller('Ctrl', ['$scope','$window', function($scope, $window){
$scope.cutSomeHeight = function() {
$scope.options.maxHeight -= 50;
}
$scope.options = {
maxHeight: 500,
data: [],
viewScale: "1 month",
columnWidth: 100
}
for (var i=0; i<100; i++){
$scope.options.data.push({name: 'Task' + i, tasks: [{name: i, from: moment("2015-01-01","YYYY-MM-DD").add(i % 12, 'months'), to: moment("2015-06-01","YYYY-MM-DD").add(i % 12, 'months')}]})
}
}]);
</script>
<div ng-controller="Ctrl">
<button ng-click="cutSomeHeight()">Cut</button>
<div gantt options="options"></div>
</div>
</body>
</html>