MVC-显示来自sqlite数据库的图像

时间:2019-04-27 11:09:12

标签: c# angularjs model-view-controller

如何从DB-Sqlite导出图像并在视图中显示该图像? 我使用角度代码,并且图像字节现在存储在x.img var中。 我想在img标签中显示图像。 我尝试了几种方法... 请您帮忙。

  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
    <link href="~/Content/productmenuStyle.css" rel="stylesheet" />
    <script src="~/Scripts/angular.js"></script>

    <script type="text/javascript">

        var app = angular.module("myCode", []);

        app.controller("CodeController", function ($scope, $http) {
            $scope.Table = false;

            $scope.showProduct = function (num) {
                $scope.number = num;
                $scope.getProduct(num);
            }

            $scope.getProduct = function (num) {
                var list = $http({
                    method: 'post',
                    url: 'getProductjson',
                    params: {
                        prClass: num
                    }
                });
                list.then(function (list) {
                    $scope.Products = list.data;
                }, function () {
                    alert("Inavalid data !!!");
                });
            }

            $scope.sendProduct = function (num) {
                var list = $http({
                    method: 'post',
                    url: 'sendProduct',
                    params: {
                        pid: num,
                    }
                });
                list.then(function (list) {
                    alert("The Product Addad To The Cart");
                }, function () {
                    alert("Inavalid data !!!");
                });
            }
        });

    </script>
</head>

0 个答案:

没有答案