Javascript 在前端显示角度JSON数组
我的数据格式如下:Javascript 在前端显示角度JSON数组,javascript,json,angularjs,Javascript,Json,Angularjs,我的数据格式如下: var data = [{"time":1,"description":"Here lies 1","cost":"10"},{"time":2,"description":"Here lies 2","cost":"20"},{"time":3,"description":"Here lies 3","cost":"10"},{"time":4,"description":"Here lies 3","cost":"10"}] 我正在尝试使用 &l
var data = [{"time":1,"description":"Here lies 1","cost":"10"},{"time":2,"description":"Here lies 2","cost":"20"},{"time":3,"description":"Here lies 3","cost":"10"},{"time":4,"description":"Here lies 3","cost":"10"}]
我正在尝试使用
<div class="container">
<h3 class="text-center">Welcome to our scheduling page. Please follow the instructions to add an event to my calendar.</h3>
<div ng-app="TimeSlot">
<div class="col-md-12" ng-controller="TimeSlotController as calendar" >
<div class="col-md-5 col-md-offset-1 timeblock" ng-repeat="slots in calendar.timeslot" ng-click="">
<h3 class="event-type-name">{{slots.time}} Hour Appointment</h3>
<div class="description mts">{{slots.description}}</div>
<div class="cost">{{slots.cost }}</div>
</div>
</div>
</div>
</div>
div会根据对象的数量重复,但值不会插入到视图中,这是为什么
这看起来可能重复了我之前的问题,但不完全一样,抱歉,如果我重复的话 我认为你的代码错了。。试试这个
app.controller("TimeSlotController", function($scope) {
$scope.timeslot = timeslots;
});
<div ng-app="TimeSlot">
<div class="col-md-12" ng-controller="TimeSlotController" >
<div class="col-md-5 col-md-offset-1 timeblock" ng-repeat="slots in timeslot" ng-click="">
<h3 class="event-type-name">{{slots.time}} Hour Appointment</h3>
<div class="description mts">{{slots.description}}</div>
<div class="cost">{{slots.cost }}</div>
</div>
</div>
</div>
app.controller(“TimeSlotController”,函数($scope){
$scope.timeslot=时间段;
});
{{slots.time}}小时预约
{{slots.description}}
{{slots.cost}}
我的问题是车把,所以我只是使用插值提供程序来修复它
$InterpologeProvider既不能复制,也不能复制未包含在该小提琴中的内容
angular animate.js
是angular.js
的一个插件,它不是它的替代品。你不仅需要担心你是对的,它在新版本中也可以工作;有趣的是,我不能在当地做这件事。我用的是手杖,它对我有帮助吗?
app.controller("TimeSlotController", function($scope) {
$scope.timeslot = timeslots;
});
<div ng-app="TimeSlot">
<div class="col-md-12" ng-controller="TimeSlotController" >
<div class="col-md-5 col-md-offset-1 timeblock" ng-repeat="slots in timeslot" ng-click="">
<h3 class="event-type-name">{{slots.time}} Hour Appointment</h3>
<div class="description mts">{{slots.description}}</div>
<div class="cost">{{slots.cost }}</div>
</div>
</div>
</div>