0

I am using ng-source to display an image. According to properties in the image my filepath is correct. According to the properties my sourcefolder is C:\testImageFolder. And the images name is test.jpg so therefore the image source should be C:\testImageFolder\test.jpg but that image is not showing up, However if i use an image from online my image is showing.

HTML-

      <div class="modal-body">
      <div class="panel panel-info">

<div class="panel-heading">Attachment</div>
<!-- <div class="panel-body"> -->
<img ng-src="{{img_source}}">

js

      function imageModalController($scope, $http, employeeFactory, $modalInstance) {
$scope.getImageReturn = function() {
    $scope.img_source = "C:\testImageFolder\test.jpg";
    //data.path;
};
$scope.getImageReturn();
$scope.cancel = function() {

    $modalInstance.dismiss('cancel');
};

$scope.signUp = function() {
    // alert("call signUp");
    window.location = "index.html#/signUp";
};

$scope.getImage = function(email) {

    employeeFactory.getImage(mail);

};

}

2
  • Have you ever seen something like C:\testImageFolder\test.jpg as an image path in the internet? Commented Jan 16, 2014 at 0:15
  • zerkms even if you were to do it as / instead if \ it still wouldnt work Commented Jan 16, 2014 at 0:20

1 Answer 1

1

It's generally best to run angular against a local web server, but if you must display something directly from the filesystem, you need to use a filesystem URI:

$scope.img_source = "file:///c:/testImageFolder/test.jpg";
Sign up to request clarification or add additional context in comments.

1 Comment

when doing that i get resource not allowed to be loaded

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.