2017-11-20 2 views
0

Bitte helfen Sie mir nennen, wie ich $ scope.Loading

von rootscope $
app.run(function ($rootScope) { 
     $rootScope.$on('$stateChangeStart', function ($scope) { 
     $scope.Lodge="Hello Loading....." 
    }) 
    $rootScope.$on('$stateChangeSuccess', function() {  
    }) 

Htmlpage nennen

i Rufen Sie einfach als

{{Lodge}} 
+0

Verwenden '$ rootScope.Lodge = "..."' obwohl ich nicht mit '$ rootScope' für diese Art der Sache empfehlen. –

+0

@Nokolaj Dam oo Vielen Dank –

Antwort

1

Nach ist ein Weg zu tun:

In HTML

<div ng-show="loading">Hello loading</div> 
//you can add some CSS if you use like this maybe a transparent BG color etc. 

Kontroller

$scope.loading = true; //loader enabled 
$scope.loading = false; //loader disabled 
//You can use the same with $rootScope too. you can enable and disable wherever needed by just making it true or false; 
+0

@Ujjjwala Vielen Dank für Ihre Rückmeldung bt meine Anfrage ist etwas anders –

+0

Sie können nicht $ Scope dort in run !. Verwenden Sie nur $ rootScope –