Home AngularJs How we can show div after some time using AngularJS?

How we can show div after some time using AngularJS?

by Shahriar Sagor

Today now in this post i will show you How to hide div after some time using AngularJS? Sometimes we need to do like hide any div or text or any tag after the some time by using AngularJS. Now in this example i am going to show you how we can do it.

We know in AngularJS has $timeout variable, by using $timeout variable we can set the specific time after hide. We can easily set the time for hide or show. Now in this simple example we can see how it is working.

So in the bellow example we can see and run the bellow file in your machine.

<!DOCTYPE html>
	<title>Angularjs ng-hide div after few seconds</title>
	<script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
	<div ng-app = "mainApp" ng-controller = "myController">
		<p ng-hide="isCheck" style="background:red;padding:5px;">{{ myText }}</p>
            var mainApp = angular.module("mainApp", []);
	    mainApp.controller('myController', function($scope, $timeout) {
	      	$scope.myText = "This is for example";
	      	$scope.isCheck = false;

	      	$timeout(function () { $scope.isCheck = true; }, 20000);

Read Also: How to implement infinite ajax scroll pagination in Laravel?

Thanks for read. I hope it help you. For more you can follow us on facebook


You may also like