members of the Angular Technorati. I come to you with a puzzling issue,
although simple. I need to switch out a div layer after about 11 seconds
and show another div layer. How is this done using angularjs timeout
service, preferably within a controller?
Ok, what if I combined a show and hide event with the $timeout service?
<body ng-app="myApp">
<div ng-controller="showHideController" ng-init="getPanel_1()">
<div ng-controller="showHideController" ng-show="divA"style=''>
</div>
<div ng-controller="showHideController" ng-show="divB" style=''>
</div>
<script>
angular.module('myApp',[]).controller('showHideController',function($scope,
$timeout) {
$scope.getPanel_1 = function(){
$scope.divA = true;
$scope.divB = false;
$scope.divC = false;
}
$timeout(function (){
$scope.getPanel_1 = function(){
$scope.divA = false;
$scope.divB = true;
$scope.divC = false;
}
}, 5000);
});
</script>
Thanks in advance, Batoe.
"The road to success is filled with obstacles......but also success!" The
unknown optimist.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.