Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS:从JSON显示SVG_Angularjs_Svg - Fatal编程技术网

AngularJS:从JSON显示SVG

AngularJS:从JSON显示SVG,angularjs,svg,Angularjs,Svg,我想使用RESTAPI显示json中的svg文件,但我还没有显示它 json文件: { "id": "sample string 1", "svg": "/PlanSvg/Planwidget", "name": "plan" } Controller.js: $scope.LoadLeaf = function (Id_Leaf) { REST.DoGET(PATH_LEAF, "/" + Id_Leaf).success(function (data) {

我想使用RESTAPI显示json中的svg文件,但我还没有显示它

json文件:

{
  "id": "sample string 1",
  "svg": "/PlanSvg/Planwidget",
  "name": "plan"
}
Controller.js:

$scope.LoadLeaf = function (Id_Leaf) {
    REST.DoGET(PATH_LEAF, "/" + Id_Leaf).success(function (data) {
        $scope.Leaf = data;

    }).error(function () {

    });
}
<div ng-controller="MapLiveWidget">
    <div >{{Leaf.id}}</div>
    <div>{{Leaf.name}}</div>
    <div><img ng-src="Leaf.svg'"</div>
</div>
$scope.LoadLeaf=函数(Id\u Leaf){
REST.DoGET(路径\叶,“/”+Id \叶).success(函数(数据){
$scope.Leaf=数据;
}).错误(函数(){
});
}
{{Leaf.id}
{{Leaf.name}

您是否将SVG数据恢复到控制台日志中?如果是这样,您还可以包含svg数据吗?我可以展示如何在视图中动态包含它。您好,在控制台日志中,我没有成功获取svg数据,我只成功获取路径:“/PlanSvg/Planwidget”。如果你不清楚你在这里要求什么,你有没有在调试面板中查看请求是否已发出并且由于某种原因未能加载响应?如果不查看网络面板,查看发生了什么或没有发生什么。404只是表示路径/url错误,或者服务器找不到匹配的资源,这是您试图从本地服务器加载的文件吗?看起来您在该路径中有两次PlanSvg,这是问题吗?是的,我尝试从桌面加载svg文件。我有一个错误:Get404(未找到