【发布时间】:2016-01-08 05:01:37
【问题描述】:
我正在尝试使用 Angular $http.get 检索 json 数据。但我的价值是不确定的。
我的 Json 文件如下
[
{
"BannerText": "The First Mobile SSP. Truly Optimized for Outstream Video",
"IntroText": "Chololate SSO provides necessary infrastructure for app monetization thgough video ads. More than 150 million people worldwide see a Chocolage SSP ad each month.",
"SolutionHeaderText": "Solution For Publishers",
"SolutionValueText": "Unlock the true potential of your mobile inventory with industry leading eCPMs & Fill Rates"
}
]
脚本文件
.controller('HomeCtrl', function ($scope, $http) {
alert('Called');
$http.get("data/homeData.json")
.success(function(data) {
$scope.details = data;
alert($scope.details.BannerText);
});
});
HTML
<div ng-controller="HomeCtrl">
<div class="banner-section">
<div class="banner-text text-center">
<p>{{ details.BannerText }}</p>
</div>
</div>
</div>
【问题讨论】: