我正在使用ng-source来显示图像。根据图像中的属性,我的文件路径是正确的。根据属性我的源文件夹是C:\ testImageFolder。图像名称是test.jpg因此图像源应该是C:\ testImageFolder \ test.jpg但是图像没有显示,但是如果我使用在线图像显示我的图像。
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);
};
}
答案 0 :(得分:1)
通常最好对本地Web服务器运行角度,但如果必须直接从文件系统显示某些内容,则需要使用文件系统URI:
$scope.img_source = "file:///c:/testImageFolder/test.jpg";