如何在角度js中更新视图中的图像

时间:2017-11-06 14:14:13

标签: angularjs angularjs-directive angularjs-scope

我正在设计一个图像并进行保存。图像是第一次在视图中绑定。当我重新设计相同的时候 图像并再次保存。但视图未更新。

$scope.$on('Save', function () {
                vm.save();
                if (vm.scenarioStoryBoardData.ScenarioStoryBoard.isDesigner) {
                    var file = vm.DrawStateService.getBlob();
                    file.name = vm.parentScenario.replace(" ", "") + "_scenario_storyboard.png";
                    Upload.upload({
                        url: BodStudioServicesEndpoint + "TechnologyStoryboardImage/Upload?UserId=" + LoggedInUserGUID,
                        method: "POST",
                        data: { file: file },
                        cache: false
                    }).then(function (resp) {                            
                        vm.scenarioStoryBoardData.ScenarioStoryBoard.ImgSrc = resp.data;
                        $scope.$parent.studio.saveBodData();
                    }, function (resp) {
                        console.log('Error');
                    }, function (evt) {
                        var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
                    });
                }
                else
                    $scope.$parent.studio.saveBodData();
            });

 <img ng-click="scenarioStoryboard.importGallery();scenarioStoryboard.currParentIndex = -1;scenarioStoryboard.isAllowToDelete = true;" class="img-responsive" ng-if="scenarioStoryboard.scenarioStoryBoardData.ScenarioStoryBoard.ImgSrc" ng-src="{{scenarioStoryboard.imagesUrl}}{{scenarioStoryboard.scenarioStoryBoardData.ScenarioStoryBoard.ImgSrc}}" />

0 个答案:

没有答案