【发布时间】:2017-01-25 13:49:49
【问题描述】:
我正在尝试实现类似于全屏模式的功能:使用一个按钮触发全屏模式,然后使用另一个按钮返回。
主题:
<div ng-class="{full: !presentationMode}">
<div id="child-div>content</div> //div has 100% height
</div>
触发器:
<button ng-click="present()">Click me!</button>
在控制器中我这样做:
$scope.present = () => {
$scope.presentationMode = !$scope.presentationMode;
var myDiv = angular.element('#container');
// when $scope.presentationMode is true
// myDiv.height() is not the height set by the "full" class, but it is always reversed (the previous value)
// It !sometimes! work if I use $timeout.
}
我应该如何处理这种情况?
【问题讨论】:
标签: javascript angularjs angularjs-scope ng-class