Debuginfo

思考とアウトプット

AngularJSでng-showをコールバック等で使うときは$applyを使う

下記のようなViewがあって、

<div ng-show="showPicture"> picture here! </div>

そのオンオフをFactory側で行うときは、$scopeのスコープ外なので$apply()をしないと反映されない。

    Creator.initialize($scope.loginStatus.userID, function(){ 
        $scope.showPicture = !$scope.showPicture;
        $scope.$apply();
    });
参考