这是我的第一个问题。请多多包涵。
我有一个表格,其中一个列显示图像,而不是在表格的列中显示图像,我想在用户单击查看图像时将其更改为同一窗口上的弹出图像。我尝试使用 windows.open(imgSrc),弹出新窗口(我没有打开新窗口)并下载图像。我附上了我的一段代码。请帮我。
身体
<td data-title='"Background Image"' header-class='text-left'><a href="#" ng-click="Page.Functions.GetBackgroundImageUrl(item)">View Image</a></td>
JS
$scope.Page.Functions.GetBackgroundImageUrl = function (hero) {
if (hero && hero.BackgroundImageExist) {
var v = $scope.Page.Functions.GetDataVersion(hero.Id);
if (v) {
v = '?v=' + v;
}
window.open(ENV.apiUri + 'HomePageHero/BackgroundImage/' + hero.Id + v, "window Title", "width = 500, height = 450");
}
return null;
}
在表格列中显示图像的代码
<td data-title='"Background Image"' header-class='text-left'><display-media model='Page.Functions.GetBackgroundImageUrl(item)'></display-media></td>
JS
$scope.Page.Functions.GetHtmlText = function (rawText) {
return $sce.trustAsHtml(rawText);
}
$scope.Page.Functions.GetBackgroundImageUrl = function (hero) {
if (hero && hero.BackgroundImageExist) {
var v = $scope.Page.Functions.GetDataVersion(hero.Id);
if (v) {
v = '?v=' + v;
}
return 'imageUrl:' + ENV.apiUri + 'HomePageHero/BackgroundImage/' + hero.Id + v;
}
return null;
}