Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 将图像显示为同一窗口上的弹出窗口_Html_Css_Angularjs_Angular_Angularjs Scope - Fatal编程技术网

Html 将图像显示为同一窗口上的弹出窗口

Html 将图像显示为同一窗口上的弹出窗口,html,css,angularjs,angular,angularjs-scope,Html,Css,Angularjs,Angular,Angularjs Scope,这是我的第一个问题。请容忍我 我有一个表格,其中一列显示图像,而不是在表格的列中显示图像,当用户单击“查看图像”时,我想在同一窗口上更改为弹出图像。我尝试使用windows.open(imgSrc),新窗口弹出(我不想打开新窗口)和图像下载。我附上了我的一段代码。请帮帮我 身体 在表格列中显示图像的代码 <td data-title='"Background Image"' header-class='text-left'><display-media model='Page.

这是我的第一个问题。请容忍我

我有一个表格,其中一列显示图像,而不是在表格的列中显示图像,当用户单击“查看图像”时,我想在同一窗口上更改为弹出图像。我尝试使用windows.open(imgSrc),新窗口弹出(我不想打开新窗口)和图像下载。我附上了我的一段代码。请帮帮我

身体

在表格列中显示图像的代码

<td data-title='"Background Image"' header-class='text-left'><display-media model='Page.Functions.GetBackgroundImageUrl(item)'></display-media></td>

您正在将图像传递到
窗口。打开
将打开一个新的浏览器窗口,这就是它的工作,您正在寻找打开图像的模式


我建议尝试根据页面上的单图像模式示例修改代码。

看起来您使用的是AngularJS。如果您也在使用引导,这个答案可能会有用
$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>
$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;
}