<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/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 specified number of milliseconds.</p>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $timeout) {
$scope.myHeader = "Hello World!";
$timeout(function () {
$scope.myHeader = "How are you today?";
}, 2000);
});
</script>
</body>
</html>
// Code goes here
/* Styles go here */
<div>
w3s120-AngularJS Service TimeOut
<br/>
code example:
<hr>
index.html
<br/>
<textarea
id='codeoutput'
style="width: 100%;height: 300px;background-color: #dffff4;
font-size: 1em;font-family: Verdana, Arial, Helvetica, sans-serif;
border: 1px solid black;">
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/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 specified number of milliseconds.</p>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $timeout) {
$scope.myHeader = "Hello World!";
$timeout(function () {
$scope.myHeader = "How are you today?";
}, 2000);
});
</script>
</body>
</html>
</textarea>
<hr/>
<iframe
allowfullscren="allowfullscren"
frameborder="0"
src="https://embed.plnkr.co/dHv22gwRPLJ9UYqmnVr1?show=preview"
style="height: 400px; width: 100%;">
</iframe>
<hr>
https://www.w3schools.com/angular/angular_services.asp
<hr>
201603
</div>