<!DOCTYPE HTML>
<html ng-app="myApp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script src="angular.min.js"></script>
<script>
var m1 = angular.module('myApp',[]);
m1.service('myService',FnService);
function FnService(){
this.name = 'hello'
}
FnService.prototype.age = 20; m1.controller('Aaa',['$scope','myService',function($scope,myService){
console.log(myService.name);
}]) </script>
</head> <body>
<div ng-controller="Aaa"> </div>
</body>
</html>
<!DOCTYPE HTML>
<html ng-app="myApp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script src="angular.min.js"></script>
<script>
var m1 = angular.module('myApp',[]);
// m1.service('myService',FnService);
// function FnService(){
// this.name = 'hello'
// }
// FnService.prototype.age = 20; m1.constant('myService','hello angular11'); m1.config(['myService',function(myService){
console.log(myService);
}])
m1.controller('Aaa',['$scope','myService',function($scope,myService){
console.log(myService);
}]) </script>
</head> <body>
<div ng-controller="Aaa"> </div>
</body>
</html>

最新文章

  1. 进程监控工具supervisor 启动Mongodb
  2. ARM的常数表达式
  3. es6+移动轮播插件
  4. 使用Form Builder创建Form具体步骤
  5. ubuntu下firefox无法看bilibili解决方案
  6. 安装python官方的mysql库“mysql-connector-python”
  7. iOS代码规范文档
  8. IE6不支持&lt;a&gt;标签以外元素的hover的解决方案
  9. Python+Selenuim测试网站,只能打开Firefox浏览器却不能打开网页的解决方法
  10. MySQL模糊查询中通配符的转义
  11. GCJ-02火星坐标系和WGS-84坐标系转换关系
  12. 动态生成table 列
  13. Zoomit的用法总结
  14. 未能加载文件或程序集“System.Web.Http.WebHost, Version=4.0.0.0, ”或它的某一个依赖项。系统找不到指定的文件。
  15. 20135202闫佳歆--week5 课本18章学习笔记
  16. Hibernate Annotation 设置字段的默认值
  17. Sketch Up常见问题
  18. win7 64位机ODBC的数据源DSN添加和移除问题
  19. require-ensure
  20. 关于swagger文档的使用方法

热门文章

  1. git项目初始化的问题汇总
  2. Windows下MySQL安装配置与使用
  3. Broadcom GNSS xxx Geolocaltion Sensor与Windows导航程序的兼容性(转)
  4. Promotion Counting(USACO)
  5. trickle charging current is 0A ?
  6. rabbitmq web管理页面无法访问
  7. git 本地与远程关联流程
  8. PHP使用AJax轮询实现新订单实时提醒
  9. (1)IIS
  10. 给出一个string字符串,统计里面出现的字符个数