我有HTML代碼編輯個人資料頁面如下:
<img ng-src="{$root.user.userProfilePic}" />
其中$rootScope.user.userProfilePic = "imageUrlHere" />
然而,當我在同一個頁面更新userProfilePic再次使用控制器,配置文件圖像仍然保持不變。這不會發生,如果我使用$scope
。我怎樣才能解決它?
UpdateUserProfilePicApi.then(function (res) {
$rootScope.user.userProfilePic = res.imgUrl;
});