Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
$timeout Service in AngularJs
WhatsApp
Ajay Malik
Aug 19
2016
621
0
0
<!DOCTYPE html
>
<
html
>
<
script
src
=
"http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"
>
</
script
>
<
body
>
<
div
ng-app
=
"myApp"
ng-controller
=
"myCtrl"
>
<
p
>
This header will change after two seconds:
</
p
>
<
h1
>
{{myHeader}}
</
h1
>
</
div
>
<
p
>
The $timeout service runs a function after a sepecified number of milliseconds.
</
p
>
<
script
>
var
app
=
angular
.module('myApp', []);
app.controller('myCtrl', function($scope, $timeout) {
$
scope.myHeader
=
"wait for a while"
;
$timeout(function () {
$
scope.myHeader
=
"Welcome to C#corner"
;
}, 2000);
});
</
script
>
</
body
>
</
html
>
service
AngularJs
Up Next
$timeout Service in AngularJs