Greetings, esteemed members of the Angular Technorati. I bring forth a perplexing yet seemingly simple issue that requires your expertise. My goal is to dynamically switch out a div layer after approximately 11 seconds and display another div layer. How can I achieve this using the AngularJS timeout service, all within a controller?
I wonder, could a clever combination of show and hide events with the $timeout service be the key to solving this challenge?
<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>
My gratitude for your forthcoming assistance, Batoe.
"The path to achievement may be lined with challenges... but also victories!" A hopeful philosopher.