我正在尝试从我的JSON文件中调用我网站上各种不同部分的多个对象。目前我有工作和部分标题的misc部分等。我的HTML有以下
<h2>{{job.jobTitle}}</h2>
这很好用。但是,misc部分不显示任何内容
<h1>{{title.widgetTitle}}</h1>
"jobs": [
{
"jobTitle": "Senior Accountant",
"sector": "Accounting & Finance",
"link": "/jobs/1"
},
],
"title": [
{"widgetTitle": "Latest Jobs"}
]
HTML
<div class="tickr-container" data-ng-controller="tickCtrl">
<div>
<h1>{{title[0].widgetTitle}}</h1>
</div>
<div>
<h3>{{date | date:'fullDate' : 'GMT'}}</h3>
<ul ng-mouseover="stopAuto()" ng-mouseleave="startAuto()" class="tickrSlider">
<li class="tickrSlider-slide" ng-class="{'job-active' :isActive($index)}" data-ng-repeat="job in jobs">
<div class="tickrSlider-inner">
<h2>{{job.jobTitle}}</h2>
<p>{{job.sector}}</p>
<a class="tickrSlide-info" href="{{job.link}}">{{job.link}}</a>
</div>
</li>
</ul>
答案 0 :(得分:0)
你不应该参考title[0].widgetTitle
吗?
<h2>{{job.jobTitle}}</h2>
显示正常,因为您引用job
data-ng-repeat="job in jobs"
对象