Commit 83863d963d7d2d77f82e12ac07a0f55726eeb0e7
1 parent
02d216bc
Exists in
master
and in
8 other branches
Add a better feedback on loading home content
Showing
2 changed files
with
24 additions
and
3 deletions
Show diff stats
src/app/partials/inicio/inicio.controller.js
@@ -19,7 +19,11 @@ | @@ -19,7 +19,11 @@ | ||
19 | vm.$log.debug('InicioController'); | 19 | vm.$log.debug('InicioController'); |
20 | } | 20 | } |
21 | InicioController.prototype.init = function() { | 21 | InicioController.prototype.init = function() { |
22 | - this.loadHomeArticle(); | 22 | + var vm = this; |
23 | + | ||
24 | + vm.error = null; | ||
25 | + vm.loading = true; | ||
26 | + vm.loadHomeArticle(); | ||
23 | }; | 27 | }; |
24 | 28 | ||
25 | InicioController.prototype.loadHomeArticle = function() { | 29 | InicioController.prototype.loadHomeArticle = function() { |
@@ -33,9 +37,11 @@ | @@ -33,9 +37,11 @@ | ||
33 | } | 37 | } |
34 | 38 | ||
35 | vm.ArticleService.getHome(function(data) { | 39 | vm.ArticleService.getHome(function(data) { |
40 | + vm.loading = false; | ||
36 | vm.article = data.article; | 41 | vm.article = data.article; |
37 | }, function(error) { | 42 | }, function(error) { |
38 | vm.$log.error('Error on getHome article.', error); | 43 | vm.$log.error('Error on getHome article.', error); |
44 | + vm.error = 'Erro ao carregar o conteúdo principal.'; | ||
39 | }); | 45 | }); |
40 | }; | 46 | }; |
41 | 47 |
src/app/partials/inicio/inicio.html
@@ -11,8 +11,23 @@ | @@ -11,8 +11,23 @@ | ||
11 | </div> | 11 | </div> |
12 | </div> | 12 | </div> |
13 | </section> | 13 | </section> |
14 | -<section class="section-gray"> | 14 | + |
15 | +<section class="info-section" ng-if="inicio.loading || inicio.error"> | ||
16 | + <div class="container"> | ||
17 | + <div class="col-md-12"> | ||
18 | + <div ng-if="inicio.loading && !inicio.error"> | ||
19 | + <div class="alert alert-info">Carregando conteúdo...</div> | ||
20 | + </div> | ||
21 | + | ||
22 | + <div ng-if="inicio.error"> | ||
23 | + <div class="alert alert-danger">{{inicio.error}}</div> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | +</section> | ||
28 | + | ||
29 | +<section class="section-gray" ng-if="inicio.article"> | ||
15 | <div class="container"> | 30 | <div class="container"> |
16 | - <programa-list ng-if="inicio.article" article="inicio.article"></programa-list> | 31 | + <programa-list article="inicio.article"></programa-list> |
17 | </div> | 32 | </div> |
18 | </section> | 33 | </section> |