Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
afeiship committed May 17, 2016
1 parent 5f0cfb3 commit 4c44edc
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,49 @@ body {
```
+ javascript part:
```javascript
angular.module('TestApp', ['nx.widget']);
angular.module('TestApp', ['nx.widget']);

angular.module('TestApp').
controller('MainCtrl', function ($http, $q, $rootScope) {
$rootScope.loading = false;
var s1 = $http.get('http://www.baidu.com');
var s2 = $http.get('http://www.sina.com');
var s3 = $http.get('http://www.163.com');
var s4 = $http.get('http://www.qq.com');
var s5 = $http.get('http://www.hao123.com');
controller('MainCtrl', function ($http, $q, $rootScope) {
//Solution 1:Use loading element to show the loading indicator
$rootScope.loading = false;
var s1 = $http.get('http://www.baidu.com');
var s2 = $http.get('http://www.sina.com');
var s3 = $http.get('http://www.163.com');
var s4 = $http.get('http://www.qq.com');
var s5 = $http.get('http://www.hao123.com');

//you need a VPN if you're a Chinese(Thanks to the GFW)
var s6 = $http.get('https://www.google.com/');
//you need a svn if you're a chinese
var s6 = $http.get('https://www.google.com/');


$q.all([s1, s2, s3, s4, s5]).then(function (responses) {
console.log(responses);
})


$q.all([s1, s2, s3, s4, s5, s6]).then(function (responses) {
console.log(responses);
})
.controller('MainCtrl2', function ($http, $q, $rootScope, nxIsLoading) {
//Solution 2:Or you can directly watch nxIsLoading.isLoading method:
$rootScope.$watch(nxIsLoading.isLoading,function(inValue){
$rootScope.loading = inValue;
});

var s1 = $http.get('http://www.baidu.com');
var s2 = $http.get('http://www.sina.com');
var s3 = $http.get('http://www.163.com');
var s4 = $http.get('http://www.qq.com');
var s5 = $http.get('http://www.hao123.com');

//you need a svn if you're a chinese
var s6 = $http.get('https://www.google.com/');


$q.all([s1, s2, s3, s4, s5]).then(function (responses) {
console.log(responses);
})

});
});

```

Expand Down

0 comments on commit 4c44edc

Please sign in to comment.