Javascript NgAnimate页面加载黑客
使用更新版1.4.1,AngularJs Animate不会像以前那样在页面加载时触发。我以前的解决方案也是类似的(找到并一直运行到v1.3.9)Javascript NgAnimate页面加载黑客,javascript,angularjs,Javascript,Angularjs,使用更新版1.4.1,AngularJs Animate不会像以前那样在页面加载时触发。我以前的解决方案也是类似的(找到并一直运行到v1.3.9) 角度模块('app',['ngAnimate'])) .controller('control',函数($scope,$rootElement){ $rootElement.data(“$$ngAnimateState”).running=false; }); h1.ng-enter{ 不透明度:0; -moz过渡:不透明度10秒; -o型过渡:不
角度模块('app',['ngAnimate']))
.controller('control',函数($scope,$rootElement){
$rootElement.data(“$$ngAnimateState”).running=false;
});
h1.ng-enter{
不透明度:0;
-moz过渡:不透明度10秒;
-o型过渡:不透明度10秒;
-webkit过渡:不透明度10秒;
过渡:不透明度10秒;
}
h1.ng-enter-active{
不透明度:1;
}
大标题
但这已经不起作用了。所以我要做的是
有棱角的
.module('app',['ngAnimate']))
.controller('control',函数($scope,$interval){
$scope.bool1=false;
$interval(函数(){
$scope.bool1=true;
}, 1, 1);
});
这对我来说是一种冒犯。在版本1.4.1+中,有没有更好的方法可以导致页面加载动画?在1.4中,$rootElement似乎没有定义数据函数
<script>
angular.module('app', ['ngAnimate'])
.controller('contr', function ($scope, $rootElement) {
$rootElement.data("$$ngAnimateState").running = false;
});
</script>
<style>
h1.ng-enter {
opacity: 0;
-moz-transition: opacity 10s ease;
-o-transition: opacity 10s ease;
-webkit-transition: opacity 10s ease;
transition: opacity 10s ease;
}
h1.ng-enter-active {
opacity: 1;
}
</style>
</head>
<body ng-app="app" ng-controller="contr">
<h1 ng-if="true">Big headline</h1>
</body>
<script>
angular
.module('app', ['ngAnimate'])
.controller('contr', function ($scope, $interval) {
$scope.bool1 = false;
$interval(function () {
$scope.bool1 = true;
}, 1, 1);
});
</script>
<!--same css and html-->