当我打电话时,角度不会显示我的物体

问题描述 投票:0回答:1

我试图使用角度来显示铬中的2个对象,但我得到“获取http://127.0.0.1:5500/%7B%7Bproduct.imageUrl%7D%7D 404(未找到)”我使用链接到图像所以我不明白为什么它woudnt工作,我没有看到错误在代码也是。

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Marko Phoenix Production</title>
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">

    <link rel="stylesheet" href="css/style.css">
    <script src="js/angular.min.js"></script>


</head>

<body ng-app>

    <div>

        <table ng-init-'productsX=[{ "productId" : 1, "productName" : "Leaf Rake" , "productCode" : "GDN-0011" ,
            "releaseDate" : "March 19, 2009" , "description" : "Leaf rake with 48-inch handle." , "cost" : 9.00,
            "price" : 19.95, "category" : "garden" , "tags" : ["leaf", "tool" ], "imageUrl" :
            "https://www.gardeningknowhow.com/wp-content/uploads/2017/04/leaf-rake-400x267.jpg" }, { "productId" : 5,
            "productName" : "Hammer" , "productCode" : "TBX-0048" , "releaseDate" : "May 21, 2013" , "description" :
            "Curved Claw steel Hammer." , "cost" : 1.00, "price" : 8.99, "category" : "toolbox" , "tags" : ["tool"],
            "imageUrl" : "https://upload.wikimedia.org/wikipedia/commons/8/84/Claw-hammer.jpg" }]'>
            <thead>
                <tr>
                    <td>Image</td>
                    <td>Product</td>
                    <td>Code</td>
                    <td>Available</td>
                    <td>Price</td>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="product in productsX">
                    <td><img src="{{product.imageUrl}}" title="{{product.productName}}"></td>
                    <td>{{product.productName}}</td>
                    <td>{{product.productCode}}</td>
                    <td>{{product.releaseDate}}</td>
                    <td>{{product.price}}</td>
                </tr>
            </tbody>
        </table>

    </div>

</body>
angularjs
1个回答
1
投票

你应该像这样使用ng-src

<img ng-src="{{product.imageUrl}}" title="{{product.productName}}"></td>

阅读angularjs documentation

© www.soinside.com 2019 - 2024. All rights reserved.