angular1.5,$scope.$apply()强制更新

改变数据,视图不刷新的情况下,请加上$scope.$apply();

$scope.$apply(function() {
    var leftNewVal = (left / 0.5 + (mouseMoveX - mouseDownX) / 0.5);
    var topNewVal = (top / 0.5 + (mouseMoveY - mouseDownY) / 0.5);
    $scope.templatePosition.index[curKeyName].left = leftNewVal;
    $scope.templatePosition.index[curKeyName].top = topNewVal;
})

$scope.$watch('templatePosition',function(obj){
     $scope.progressStyle($scope .templatePosition);
}, true);

发表评论

邮箱地址不会被公开。 必填项已用*标注