简体   繁体   中英

Why can't my program find the images?

When I go straight into the directory via the browser, in other words localhost:8888/images/mansion-1.jpg, the image appears on the browser, but on the console, it says 404, it can't find the images. Can anybody assist me in figuring out why it cant retrieve the images?

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>ng-mansions</title>
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    </head>
<body ng-app="ngMansions" ng-controller="mansionsController">

    <!--Nav Bar-->
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">mc-mansions</a>
            </div>
        </div>
    </nav>

  <!--Real Estate Listings-->
    <div class="container">
        <div class="col-sm-4" ng-repeat="mansion in mansions">
            <div class="thumbnail">
                <img ng-src="images/{{mansion.image}}.jpg" alt="">
                <div class="caption">
                    <h3>{{mansion.address}}</h3>
                    <p><strong>Type: </strong>{{mansion.type}}</p>
                    <p><strong>Description: </strong>{{mansion.description}}</p>
                    <p><strong>Price: </strong>{{mansion.price | currency}}</p>
                </div>
            </div>
        </div>
    </div>

</body>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.min.js"></script>
    <script src="app.js"></script>
    <script src="scripts/mansionsController.js"></script>
    <script src="scripts/mansionsFactory.js"></script>
</html>

Maybe you must change this

{{mansion.image}}

To:

"+ {{mansion.image}} +"

Since it says {{mansion.image}} the actual jpg files have to be singular as well, mansion-1.jpg and not mansions-1.jpg. These details really get me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM