Angularjs 未加载的角度传感器
再一次,我确信这是我在寻找什么。我在学习angular,同时也在学习ionic框架 我终于让日历工作了,但它没有加载css。我想这可能与正确通过示波器有关,但这就是为什么我要转到这里,因为我不知道 Calendar.jsAngularjs 未加载的角度传感器,angularjs,ionic-framework,Angularjs,Ionic Framework,再一次,我确信这是我在寻找什么。我在学习angular,同时也在学习ionic框架 我终于让日历工作了,但它没有加载css。我想这可能与正确通过示波器有关,但这就是为什么我要转到这里,因为我不知道 Calendar.js angular.module('starter.Directives', []); angular.module('starter.Directives').directive("calendar", function(){ return { restrict: "E"
angular.module('starter.Directives', []);
angular.module('starter.Directives').directive("calendar", function(){
return {
restrict: "E",
templateUrl: "templates/calendar.html",
scope: { selected: "=" },
link: function(scope) {
scope.selected = _removeTime(scope.selected || moment());
scope.month = scope.selected.clone();
var start = scope.selected.clone();
start.date(1);
_removeTime(start.day(0));
_buildMonth(scope, start, scope.month);
scope.select = function(day) { scope.selected = day.date; };
scope.next = function() {
var next = scope.month.clone();
_removeTime(next.month(next.month()+1).date(1));
scope.month.month(scope.month.month()+1);
_buildMonth(scope, next, scope.month);
};
scope.previous = function() {
var previous = scope.month.clone();
_removeTime(previous.month(previous.month()-1).date(1));
scope.month.month(scope.month.month()-1);
_buildMonth(scope, previous, scope.month);
};
}
};
function _removeTime(date){
return date.day(0).hour(0).minute(0).second(0).millisecond(0); }
function _buildMonth(scope, start, month) {
scope.weeks = [];
var done = false, date = start.clone(), monthIndex = date.month(), count = 0;
while (!done) {
scope.weeks.push({ days: _buildWeek(date.clone(), month) });
date.add(1, "w");
done = count++ > 2 && monthIndex !== date.month();
monthIndex = date.month();
}
}
function _buildWeek(date, month) {
var days = [];
for (var i = 0; i < 7; i++) {
days.push({
name: date.format("dd").substring(0, 1),
number: date.date(),
isCurrentMonth: date.month() === month.month(),
isToday: date.isSame(new Date(), "day"),
date: date
});
date = date.clone();
date.add(1, "d");
}
return days;
}
});
我的模板正确地包含了CSS文件,我已经用纯html测试过,以确保包含了CSS
原始日历代码写在这里:
我只是想把它包含在我的爱奥尼亚项目中。你能试着在标题中添加css而不是模板中吗?仍然不起作用。如果您将我的html与原始html进行比较。原始版本有一个额外的属性ng scope,我没有,但我不知道它是如何生成的。我不相信它与ng scope有关联。别忘了清理浏览器缓存,有时我会对一些指令感到惊讶
angular.module('starter.controllers', [])
.controller('DashCtrl', function($scope) {
$scope.day = moment();
})