【发布时间】:2015-12-30 09:29:51
【问题描述】:
我正在使用 angular-gantt 库,并且在动态更改高度时遇到了一些麻烦。当我在控制器中设置 maxHeight 属性的新值时,它对视图没有影响。我认为,这样的更改应该是可能的,因为适用于演示应用程序(Angular Gantt demo - 单击布局-> 高度时)。也许我错过了什么?欣赏任何线索。
这是我的示例代码:
<!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>
【问题讨论】:
标签: javascript angularjs gantt-chart