Angular $scope variable not updating

后端 未结 6 1488
一整个雨季
一整个雨季 2021-01-02 04:19

In my angular, I define a scope variable $scope.letter_content. When the view is loaded, I load string from my database and set it to $scope.letter_conten

6条回答
  •  悲&欢浪女
    2021-01-02 04:47

    I had very similar but even weirder problem where I was updating one of my scope variables using the response from an HTTP call, surprisingly, my view will not update unless I make another HTTP call and by another I mean any other random HTTP call.

    Using the $apply worked for me,

    $scope.$apply(function () {
         $scope.resultData.totalResults = response.data.total;
    });
    

提交回复
热议问题