【发布时间】:2013-06-20 07:42:56
【问题描述】:
我很确定这又是一件愚蠢的事情。我正在学习 angularjs,所以我还没有得到完整的范围,但我已经到了。我尝试了所有方法并真正搜索了我能找到的任何东西,但似乎没有任何效果。
我正在尝试在我的布局文件中执行 ng-class="..." 但表达式已在我的控制器中设置但不知何故它没有呈现。当我把它放在我的 ng-view 文件中时,它会被渲染。我知道他只渲染文件的一部分,但我希望他也能在 ng-view 上渲染 ng-class。这是可能的还是在部分html文件中放入一个div更容易。
简单的html文件
<body>
<ng-view ng-class="{ 'splash': splash=='splash' }"></ng-view>
</body>
我的控制器
angular.module('xxx.splash')
.controller('IndexCtrl', function($scope, $rootScope, config) {
$rootScope.splash = 'splash';
$scope.login = function(e) {
alert('Soon. How soon? Very soon.');
}
});
【问题讨论】: