gpt4 book ai didi

javascript - 使用 AngularJS 在我的 View 中渲染另一个 json 中的 json

转载 作者:行者123 更新时间:2023-12-03 12:12:05 24 4
gpt4 key购买 nike

我正在从 Angular 数据库中读取一个如下所示的 json:

    {"content":"{
"address": "<p>This is a test</p>",
"email": "<p><a href='mailto:info@info.com'>info@info.com</a></p>",
"country": "UK"
}"}

此数据通过以下方式接收:

var urlData = $resource('http://info.com/admin/get_page/2');
$scope.Data = urlData.get();

在我看来,有一个地方我只需要打印地址和另一个电子邮件,所以我想它应该是这样的:

<article class="contactInfo-group" ng-bind-html="Data.content">
{{ Data.content.address }}
</article>

我怎样才能在那里获得我想要的信息?

最佳答案

<article class="contactInfo-group">
{{ Data.content.address }}
</article>}}

json 应该是:

 $scope.data = {"content":
{
"address": "<p>This is a test</p>",
"email": "<p><a href='mailto:info@info.com'>info@info.com</a></p>",
"country": "UK"
}
}

参见 fiddle 。 http://jsfiddle.net/micronyks/9DcXA/4/

关于javascript - 使用 AngularJS 在我的 View 中渲染另一个 json 中的 json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24918914/

24 4 0
文章推荐: javascript - 如何滚动 元素?