open preview issue fixed

This commit is contained in:
antoine
2014-06-10 16:50:03 +02:00
parent db4509de2b
commit cb491d45ab

View File

@@ -261,9 +261,15 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, appS
return performSave({ saveMethod: contentResource.save, statusMessage: "Saving..." });
};
$scope.preview = function(content){
$scope.preview = function (content) {
// Chromes popup blocker will kick in if a window is opened
// outwith the initial scoped request. This trick will fix that.
//
var previewWindow = $window.open('preview/?id=' + content.id, 'umbpreview');
$scope.save().then(function (data) {
$window.open('preview/?id=' + data.id, 'umbpreview');
// Build the correct path so both /#/ and #/ work.
var redirect = Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + '/preview/?id=' + data.id;
previewWindow.location.href = redirect;
});
};