Angular 学习笔记——$provider
<!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.provider('myRandom',function(){
return{
bolInt:false,
int : function(argBol){
if(argBol){
this.bolInt = true;
}else{
this.bolInt = false;
}
},
$get:function(){
var This = this;
return function(num1,num2){
return This.bolInt?Math.round(Math.random()*(num2 - num1)) + num1: Math.random()*(num2 - num1) + num1;
}
}
} })
m1.config(['myRandomProvider',function(myRandomProvider){
myRandomProvider.int(true);
}])
m1.controller('Aaa',['$scope','myRandom',function($scope,myRandom){
console.log(myRandom(-3,6));
}]) </script>
</head> <body>
<div ng-controller="Aaa"> </div>
</body>
</html>
Angular 学习笔记——$provider的更多相关文章
- angular 学习笔记
每天进步一点点,学习笔记 笔记来自 angular权威指南 如果想要屏蔽浏览器对表单的默认验证行为,可以在表单元素上添加 novalidate 标记. 而按钮标签则完全忽略 hr e f 属性,并不 ...
- angular学习笔记
1.forEach arr:参数是key,index json:与jquery相反,参数是value,key2.str-->json JSON.parse() ang ...
- angular学习笔记(3)
一.angular的核心 1.组件 2.指令 3.服务 4.依赖注入
- angular学习笔记(2)
1.angular可观察对象 2.angular绑定方式 3.angular模板 4.angular生命周期 5.angular组件通信
- Angular 学习笔记——$http
<!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta http-equiv="C ...
- Log4j简单学习笔记
log4j结构图: 结构图展现出了log4j的主结构.logger:表示记录器,即数据来源:appender:输出源,即输出方式(如:控制台.文件...)layout:输出布局 Logger机滤器:常 ...
- angular学习资源
angular学习资源 angularjs库: https://developers.google.com/speed/libraries/devguide?hl=zh-CN#angularjs ...
- 小波说雨燕 第三季 构建 swift UI 之 UI组件集-视图集(六)Picker View视图 学习笔记
想对PickerView进行操作,只能在代码中操作. 下面 ,再添加三个label组件,然后将所有组件配置到代码中(看代码),然后要实现对PickerView的操作,就要实现它的DataSource协 ...
- DSP bootloader学习笔记1
DSP bootloader学习笔记1 彭会锋 参考: TMS320F28xx DSP中内部Flash的应用研究 http://wenku.baidu.com/view/83e9837931b765c ...
随机推荐
- codechef AUG17 T2 Chef and Mover
Chef and Mover Problem Code: CHEFMOVR Chef's dog Snuffles has so many things to play with! This time ...
- 杭电oj2022-2030
2022 海选女主角 #include <stdio.h> #include <math.h> int main(){ ][]; int n,m,x,y,z,i,j; whil ...
- nvm: node版本管理工具
安装nvm curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash node 版本切 ...
- bottle框架学习(1):命令行
在最初的一段代码,内容如下: if __name__ == '__main__': from optparse import OptionParser _cmd_parser = OptionPars ...
- 请教一下16aspx上的源代码要如何在自己的服务器上运行
很正常呀,,我下载的也有运行不成功的你要去他们16aspx论坛发帖子问这里很少有人回答你这样的问题
- J.U.C并发框架源码阅读(六)ConditionObject
基于版本jdk1.7.0_80 java.util.concurrent.locks.AbstractQueuedSynchronizer.ConditionObject 代码如下 /** * Con ...
- Educational Codeforces Round 33 (Rated for Div. 2) C. Rumor【并查集+贪心/维护集合最小值】
C. Rumor time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp ...
- servlet多线程同步问题
Servlet/JSP技术和ASP.PHP等相比,由于其多线程运行而具有很高的执行效率.•由于Servlet/JSP默认是以多线程模式执行的,所以,在编写代码时需要非常细致地考虑多线程的同步问题.•如 ...
- 洛谷—— P1680 奇怪的分组
https://www.luogu.org/problemnew/show/1680 题目背景 终于解出了dm同学的难题,dm同学同意帮v神联络.可dm同学有个习惯,就是联络同学的时候喜欢分组联络,而 ...
- Binary Tree Vertical Order Traversal -- LeetCode
Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bott ...