我正在学习AngularJs并且有许多新术语或者我开始理解这些术语但是这个我似乎无法弄清楚我做错了什么.
我想要做的就是使用Angular-Strap在我的页面上加载一个日期选择器. http://mgcrea.github.io/angular-strap/##datepickers
我得到的错误,到目前为止还没弄清楚为什么:
未捕获错误:[$ injector:modulerr]由于以下原因无法实例化模块mgcrea.ngStrap:错误:[$ injector:unpr]未知提供者:$ datepickerProvider
我的基本理解告诉我Angular正在尝试注入一个依赖于它的模块,但我在文档中找不到$ datepickerProvider的内容,我正在使用网站上的示例代码.
Html - 标记
<!DOCTYPE html>
<html lang="en" ng-app="mgcrea.ngStrap">
<head>
...
</head>
<body ng-controller="ZenwireController">
<div class="bs-example" style="padding-bottom: 24px;" append-source>
<form name="datepickerForm" class="form-inline" role="form">
<!-- Basic example -->
<div class="form-group" ng-class="{'has-error': datepickerForm.date.$invalid}">
<label class="control-label"><i class="fa fa-calendar"></i> Date <small>(as date)</small></label>
<input type="text" class="form-control" ng-model="selectedDate" name="date" bs-datepicker>
</div>
<!-- Custom example -->
<div class="form-group" ng-class="{'has-error': datepickerForm.date2.$invalid}">
<label class="control-label"><i class="fa fa-calendar"></i> Date <small>(as number)</small></label>
<input type="text" class="form-control" ng-model="selectedDateAsNumber" data-date-format="yyyy-MM-dd" data-date-type="number" data-min-date="02/10/86" data-max-date="today" data-autoclose="1" name="date2" bs-datepicker> …Run Code Online (Sandbox Code Playgroud) 我对此失去了理智,无法弄清楚这个问题.我正在使用以下代码使用morris.js呈现图表,并且我不断收到"未捕获的TypeError:无法读取未定义的属性'匹配'错误".javascript和php代码如下,是我将php json输出到控制台并将其粘贴到此 - > 输入链接描述在这里它的工作原理!但它不在我的代码中(我很好地从使用示例和jsbin中复制了)
HTML
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.0/morris.js"></script>
<meta charset=utf-8 />
<title>Temperature Monitor</title>
</head>
<body>
<h3 style="text-align: center">Temperature Monitor</h3>
<div id="tempMonitor"></div>
<script src="aquaponics.charts.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
JAVASCRIPT
function getSensorData() {
var dataSet;
$.ajax({
type: "POST",
url: "sensor-data.php",
data: { waterTemperature: true },
async: false,
success: function(data) {
dataSet = data;
}
});
return dataSet;
}
var dataSet = getSensorData();
var chart = Morris.Line({
element: 'tempMonitor',
data: [0, 0], …Run Code Online (Sandbox Code Playgroud) 我是新手使用异步,这似乎让我不知道原因或问题是什么,当我尝试加载网页时,异步调用似乎挂起并且页面永远不会被加载.这是我的实施错了吗?
CONTROLLER
public ActionResult Index()
{
var model = _partyAddOnService.Get().Result.Select(x => new AddOnModel()
{
Id = x.Id,
AddOnType = x.AddOnType,
Description = x.Description,
Name = x.Name,
Price = x.Price
});
return View(model);
}
Run Code Online (Sandbox Code Playgroud)
服务
public async Task<IEnumerable<AddOn>> Get()
{
return await _repository.GetAsync();
}
Run Code Online (Sandbox Code Playgroud)
REPOSITORY
public async Task<IEnumerable<T>> GetAsync()
{
return await Context.Set<T>().ToListAsync();
}
Run Code Online (Sandbox Code Playgroud)
更新:
我也尝试了这个,它仍然挂起......
public ActionResult Index()
{
var model = _partyAddOnService.Get();
return View();
}
Run Code Online (Sandbox Code Playgroud)
*在调试并查看任务状态时,它显示"正在等待激活"
还尝试使用ConfigureAwait方法,如文章所建议的那样.(见詹姆斯评论如下)
public async Task<IEnumerable<AddOn>> Get()
{
return await _repository.GetAsync().ConfigureAwait(false);
}
Run Code Online (Sandbox Code Playgroud) 我试图按日期排序列表,然后按描述名称排序,但是我需要具有特定描述的所有元素作为每个日期的顶部元素.
例:
01-02-2014 "Description A"
01-02-2014 "Description B"
01-02-2014 "Description C"
01-02-2014 "Description D"
01-02-2014 "Description E"
02-02-2014 "Description A"
02-02-2014 "Description B"
02-02-2014 "Description C"
02-02-2014 "Description D"
02-02-2014 "Description E"
Run Code Online (Sandbox Code Playgroud)
我需要它如何排序是按日期和描述,但也是每个日期内列表顶部的所有描述B元素.像这样,
01-02-2014 "Description B" <-- Top (Rest below is still sorted ascending)
01-02-2014 "Description A"
01-02-2014 "Description C"
01-02-2014 "Description D"
01-02-2014 "Description E"
02-02-2014 "Description B" <-- Top (Rest below is still sorted ascending)
02-02-2014 "Description A"
02-02-2014 "Description C"
02-02-2014 "Description D"
02-02-2014 "Description E"
Run Code Online (Sandbox Code Playgroud)
我试过用LINQ做这个,但我不确定它是否可以作为单个查询完成. …
Fiddler是否有办法匹配以下URL的自动响应,以便它匹配URL中间的任何通配符值?
http://test.localhost.com/accounts/ { wildcard }/notes/page/1
我在Powershell中有以下代码行可以输出数据数组。我遇到的问题是Name,Title,Department不进入列。取而代之的是,我得到了一个单列,并且每个行都位于一个单元格之间,并且之间有制表符。
$ outList | 格式表名称,标题,部门-自动> c:\ Scripts \ test2.csv
如何输出到列?
我有以下代码,当前给我一个时间跨度列表,每小时/分钟(24小时格式).我需要更改string.format以显示小时/分钟AM或PM(12小时格式).
var availableTimes =
_appointmentService.GetAvailableHours(date, appointmentId)
.Select(x => string.Format("{0:D2}:{1:D2}", x.Hours, x.Minutes));
Run Code Online (Sandbox Code Playgroud)
最好的方法是怎样做的?我没有看到任何时间跨度.
*这是它使用的GetAvailableHours方法.
public IEnumerable<TimeSpan> GetAvailableHours(DateTime? date, int? appointmentId)
{
if (date == null) return null;
var hours = new List<DateTime>();
for (var ts = new TimeSpan(); ts <= new TimeSpan(23, 30, 0); ts = ts.Add(new TimeSpan(0, 30, 0)))
{
hours.Add(date.Value + ts);
}
var booked = _appointmentRepository.Get
.Where(x =>
(!appointmentId.HasValue || x.Id != appointmentId))
.Select(x => x.ScheduledTime).ToList();
//return available hours from shifts
var workingHours = from h in hours …Run Code Online (Sandbox Code Playgroud) c# ×3
angularjs ×1
asynchronous ×1
csv ×1
fiddler ×1
formatting ×1
javascript ×1
jquery ×1
json ×1
linq ×1
list ×1
morris.js ×1
php ×1
powershell ×1
sorting ×1
timespan ×1