0
我有一個ngDialog模式,它顯示上傳的圖像並允許用戶發表評論。這是我怎麼稱呼它:從ngDialog控制器內調用ngDialog不起作用
$scope.openShowPic = function (imageName, imagedescription, username, imagelikeslength, comments, imageid) {
$scope.imageName = imageName;
$scope.imageDescription = imagedescription;
$scope.username = username;
$scope.imagelikeslength = imagelikeslength;
$scope.comments = comments;
$scope.imageid = imageid;
ngDialog.open({ template: 'views/showpic.html', scope: $scope,
className: 'ngdialog-theme-mine dialogwidth800', controller:"ShowPicController" });
};
如果用戶的令牌到期,他們遞交我有一種檢測401錯誤狀態的錯誤處理意見前,然後確保用戶註銷和關閉showPic ngDialog。然後它打開登錄ngDialog,以便用戶可以登錄。
$scope.submitComment = function() {
CommentFactory.save({id: $scope.imageid}, $scope.mycomment)
.$promise.then(
function (response) {
console.log(response);
},
function (error) {
console.log('error');
if (error.status == 401){
AuthFactory.logout();
$scope.loggedIn = false;
$scope.username = '';
ngDialog.close();
ngDialog.open({ template: 'views/login.html', scope: $scope,
className: 'ngdialog-theme-default', controller:"LoginController" });
}
});
$scope.commentForm.$setPristine();
$scope.mycomment = {
comment: ""
};
};
不幸的是,登錄ngDialog沒有與LoginController通信,因爲當用戶點擊登錄時沒有任何反應。調用登錄ngDialog的代碼與我在標題中使用的完全相同,並且工作正常。 顯然我打破了一些東西,但看不到什麼! 謝謝。