0

This is my code in my view

<div ng-controller="HomeController">
<div class="row">
    <div class="col-xs-12 col-sm-offset-1 col-sm-3">
        <div class="media">
                <div class="media-top media-middle">
                    <a ui-sref="#">
                        <img class="media-object img-thumbnail" ng-src="{{dish.image}}" alt="MENU" >
                    </a>
                    <div class="media-body">
                        <h2 class="media-heading" style="color:red">This is Hot/Featured</h2>
                    </div>
                </div>
        </div>
    </div>
</div>

This is my controller

.controller('HomeController', ['$scope', 'menuFactory', function($scope, menuFactory) {
    menuFactory.getDishes().query(
        function(response) {
            var dishes = response;
            $scope.dish= dishes[0];
        },
        function(response) {
            $scope.message='Error' + response.status+ " " + response.statusText; 
        });
}])
.controller('HomeController', ['$scope', 'menuFactory', function($scope, menuFactory) {
    menuFactory.getDishes().query(
        function(response) {
            var dishes = response;
            $scope.dish= dishes[0];
        },
        function(response) {
            $scope.message='Error' + response.status+ " " + response.statusText; 
        });
}])

This is my Service.js code

.service('menuFactory', [/*'$http'*/ '$resource', 'baseURL', function(/*$http*/ $resource, baseURL) {


                this.getDishes = function(){

                    return $resource(baseURL+"dishes",null, {'get':{method:'GET' }});              //$http.get(baseURL+"dishes");

                };


        }])

I have checked the path, it does exist. When I give the path directly, the image is displayed. When the above code is used, it is not. When I check in console, ng-src keyword itself doesn't get displayed. But the same code works in other machine which is my laptop. I think there is some dependency issue. Please help.

Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140
Praths
  • 1
  • Possible duplicate of [empty ng-src doesn't update image](http://stackoverflow.com/questions/22092687/empty-ng-src-doesnt-update-image) – qqilihq Dec 22 '16 at 11:55
  • Did you fix this problem? I may be having a similar issue – GeneralBear Feb 01 '17 at 17:19
  • Hey @mjabraham . Yes. I was running it on my local host. I had put the URL starting with "localhost" in my code, and hitting with '127.0.0.1' in my browser. Express wasn't resolving it. – Praths Feb 03 '17 at 06:40
  • And Thank you @qqilihq. – Praths Feb 03 '17 at 06:42

0 Answers0