Angularjs Loading Load Effect sample

Source: Internet
Author: User

A simple example is given below:

<! DOCTYPE html>
<meta charset= "Utf-8" >
<title></title>
<body ng-controller= "Testctrl" >
<button ng-click= "tt ()" > Click button </button>
<script src= "/ajax/libs/angularjs/1.2.0/angular.min.js" ></script>

<script src= "/angular-loading-bar/src/loading-bar.js" ></script>
<link href= '/angular-loading-bar/src/loading-bar.css ' rel= ' stylesheet '/>
<script>
Angular.module (' myApp ', [' Chieffancypants.loadingbar '])

. Controller (' Testctrl ', function ($scope, $http) {
var config = {
URL: '/test.php ',
Method: ' Get '
};
$http (config). Success (function (data) {
alert (data);
})

$scope. tt = function () {
$http (config). Success (function (data) {
alert (data);
})
}
})
</script>
</body>

The code in PHP's test.php is as follows


<?php
Sleep (3);
echo ' 3 ';


You can see that this plugin is really good, and every time you send a $http request, you can see the loading progress bar.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.