jquery - 如何使用 AngularJS 显示完整的日历动态事件?
问题描述
从 Web 服务获取数据并将响应放入calendarlist
变量中。以下是我的示例代码。提前致谢。
<div id="calendar"
ui-calendar="uiConfig.calendar"
class="span8 calendar"
ng-model="calEvents"></div>
$scope.calender1 = function() {
$scope.events = [];
//getting data from server
$http({
//web service calling here
}).then(function successCallback(response) {
//response is json array
var calendarlist;
$scope.calendarlist = response.data.result;
//for loop for event display
for (var i = 0; i < $scope.calendarlist.length; i++) {
$scope.events[i] = {
title: $scope.calendarlist[i].Schedulername,
start: $scope.calendarlist[i].startdate,
};
}
//initalizing the array
$scope.eventSources = [$scope.events];
console.log("$scope.eventSources" + $scope.eventSources);
}, function errorCallback(response) {});
}
解决方案
推荐阅读
- windows - 如何知道 powershell cmd 将返回什么类型的对象?
- android - 我们可以仅从后端服务器发送数据有效负载以获取 android 中的通知吗
- c++ - C++ 中的 IPython.embed()
- excel - 将 resultRow 变量设置为 ActiveCell
- java - 是否可以从 Thymeleaf 中的控制器更新多个模板?
- php - 从所有锚标记中删除除 href 和 target 之外的所有属性(如果 target != '')
- java - 如何使用 graphql-spqr 访问字段级 Graphql 指令
- javascript - React-Native - this.props 未定义
- python - 如何在 Tumbleweed 中构建 WxPython?
- java - 一个*系列* bean 的多个实例?