Function in angular keeps getting executed

前端 未结 1 1818
情话喂你
情话喂你 2021-01-26 22:21

I have this template in my project:



        
相关标签:
1条回答
  • 2021-01-26 23:00

    Function calls in templates get executed each digest cycle. Simply fetch the user once in your controller and assign the value to the scope

    auth.getUser(auth.currentUser()).getValue(function(value){
        $scope.user = value;
    });
    

    and in your template, instead of {{getUser()}}

    {{user}}
    
    0 讨论(0)
提交回复
热议问题