module其实就是一个容器,里面可以装controller,service,directive,filter等,

官网的解释是:Module :A container for the different parts of an app including controllers,services,filters,and directives which configures the injector.

下面的例子中定义了两个angular.module,其中第二个module,依赖第一个module,引用第一个module中的filter方法:

例子的代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script src="../materialDesignfile/angular.js"></script>
<script>
angular.module("myApp",[])
.filter("greeting",function () {
var ouyangfeng=function (name) {
debugger
return "Hello "+name;
}
return ouyangfeng;
});
angular.module("myApp2",['myApp']).controller("myCtrl",['greetingFilter','$scope',function (greetingFilter,$scope) {
$scope.name=greetingFilter("欧阳凤");
}]);
</script>
<div ng-app="myApp2" ng-controller="myCtrl">
<h1>{{name}}</h1>
</div>
</body>
</html>

最新文章

  1. Box-sizing:小身材,大拳头!
  2. Spring配置c3p0数据源时出错报:java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector
  3. HttpContextBase转换成HttpContext对象
  4. ASP.NET MVC 学习之路由(URL Routing)
  5. HD1556Color the ball(树状数组)
  6. jquery mousewheel
  7. winform Label与DataGridView右对齐 分类: WinForm 2014-05-19 20:51 446人阅读 评论(0) 收藏
  8. DoNet开源项目-基于Amaze UI的点餐系统
  9. Html 语法学习笔记二
  10. java实现大数相加问题
  11. svn地址如何更改
  12. redux+saga+reducer
  13. linq总结系列(一)---基础部分
  14. java JDBC (八) 连接池 DBCP
  15. windows(cr lf )转unix (lf)
  16. jquery实现根据所选时间生成页面元素
  17. CentOS7服务器添加新用户
  18. git初级浅入其常用操作
  19. ppt 文字按笔画进入。
  20. Microsoft Power BI Desktop概念学习系列之Microsoft Power BI Desktop的下载和安装(图文详解)

热门文章

  1. 算法竞赛入门经典-1.5.4 Q&amp;A
  2. java时间&quot;yyyy-mm-dd HH:mm:ss&quot;转成Date
  3. 如何在WIN7_64环境下安装Oracle10g_64位版本
  4. jetbraints激活码
  5. git使用ssh密钥(转)
  6. 在spring+beranate中多数据源中使用 ThreadLocal ,总结的原理 --费元星
  7. cordova 框架下开发app推送
  8. python发起请求提示UnicodeEncodeError
  9. 怎样安装PyCharm
  10. Assetbundle2