学习要点:
- 控制器模块化
- 指令模块化
- 过滤器模块化
- 服务模块化
- 定义值模块化
- 使用模块工作
第一步:创建一个模块
301_22@
在视图中应用模块
@H_301_22@
第二步:定义值
301_22@
第三步:定义服务
301_22@
第四步:定义控制器
301_22@
将控制器应用于视图
Angular App
在视图中应用模块
将控制器应用于视图
// param detail:
// scope : view scope of action
// element : the element which uses the custom directive
// attrs : the attrs of the element
return function (scope,element,attrs) {
// console.log(dayFilter(scope.day));
if (dayFilter(scope.day) == attrs['highlight']) {
element.css("color",'red');
}
}
})
@H_301_22@
将指令应用于视图
将过滤器应用于视图
最后,下面是完整的代码: