Reputation: 139
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);
};
}
Upvotes: 0
Views: 596
Reputation: 565
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";
Upvotes: 1