<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="angular.min.js"></script>
</head>
<body>
<div ng-app="myApp">
<div ng-controller="firstController">
{{name}}
{{isArray}}
{{name1}}
{{eq}}
</div>
</div>
<script type="text/javascript">
var app = angular.module("myApp", []);
app.controller('firstController',['$scope',function($scope){
/*$scope.name='zhangsan';
$scope.arr=[1,2,3]; $scope.isArray=angular.isArray($scope.arr);
$scope.name1=angular.uppercase($scope.name);
$scope.a='111';
$scope.b='111';
$scope.eq=angular.equals($scope.a,$scope.b);
console.log($scope.eq);//true $scope.a={name:'张三'};
$scope.b={age:10};
$scope.c=angular.extend($scope.b,$scope.a);
console.log($scope.c);//Object {age: 10, name: "张三"} var json = {"name":"hello","age":"20"};
console.log(json);//Object {name: "hello", age: "20"} $scope.json=angular.toJson(json);
console.log($scope.json);//{"name":"hello","age":"20"}
$scope.json=angular.toJson(json,true);
console.log($scope.json); var json = '{"name":"hello","age":"20"}';
console.log(json);//{"name":"hello","age":"20"}
$scope.json=angular.toJson(json);
$scope.json=angular.fromJson(json);
console.log($scope.json);//Object {name: "hello", age: "20"} $scope.a={name:'张三'};
$scope.b={age:10};
$scope.c=angular.copy($scope.a,$scope.b);
console.log($scope.a);
console.log($scope.b); var json = {"name":"hello","age":"20","sex":'男'};
angular.forEach(json,function(val,key){
console.log(val);
console.log(key);
});*/ var json = {"name":"hello","age":"20","sex":'男'};
var results=[];
angular.forEach(json,function(val,key){
console.log(val);
console.log(key);
this.push(key+'--'+val);
},results);
console.log(results); //绑定对象,作为函数的上下文
var self={name:'张三'};
var f=angular.bind(self,function(age){
$scope.info=this.name+' is '+age;
console.log($scope.info);
});
f(30); var f=angular.bind(self,function(age){
$scope.info=this.name+' is '+age;
console.log($scope.info);
},10);
f(); }]);
</script> </body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="angular.min.js"></script>
</head>
<body>
<div>
<!-- <div ng-controller="firstController" ng-app="myApp1">
{{name}}
</div>
<div ng-controller="secondController" ng-app="myApp2">
{{name}}
</div>
var app1 = angular.module("myApp1", []);
var app2 = angular.module("myApp2", []);//报错,module只会初始化一次, --> <div id='div1' ng-controller="firstController"
{{name}}
</div>
<div id='div2' ng-controller="secondController">
{{name}}
</div>
</div>
//bootstrap不是css的bootstrap,一般一个页面只有一个module,bootstrap用于页面初始化多个module,
<script type="text/javascript">
var app1 = angular.module("myApp1", []);
var app2 = angular.module("myApp2", []);//报错,module只会初始化一次,
app1.controller('firstController',function($scope){
$scope.name='张三';
});
app2.controller('secondController',function($scope){
$scope.name='李四'; });
var div1=document.getElementById('div1');
var div2=document.getElementById('div2');
document.onclick=function(){//动态加载多个module
angular.bootstrap(div1,['myApp1']);
angular.bootstrap(div2,['myApp2']);
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript" src="module02.js"></script>
<!-- module02.js:
var app2 = angular.module("myApp2", []);
app2.controller('secondController',function($scope){
$scope.name='李四';
});
app2.controller('threeController',function($scope){
$scope.name='王五';
});-->
</head>
<body ng-app="myApp">
<div>
<div ng-controller="firstController">
{{name}}
</div>
<div ng-controller="secondController">
{{name}}
</div>
<div ng-controller="threeController">
{{name}}
</div>
</div>
<script type="text/javascript">
var app1 = angular.module("myApp", ['myApp2'])//模块的依赖,['myApp2','myApp3']可以引入多个,这是插件化引入。
app1.controller('firstController',function($scope){
$scope.name='张三';
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
//jqueru要放在上面
<script type="text/javascript" src="jquery-1.11.1.js"></script>
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript" src="module02.js"></script>
<!-- module02.js:
var app2 = angular.module("myApp2", []);
app2.controller('secondController',function($scope){
$scope.name='李四';
});
app2.controller('threeController',function($scope){
$scope.name='王五';
});-->
</head>
<body ng-app="myApp">
<div>
<div ng-controller="firstController">
<div id="obj1">
</div>
{{name}}
</div>
<div ng-controller="secondController">
{{name}}
</div>
<div ng-controller="threeController">
{{name}}
</div>
</div>
<script type="text/javascript">
var app1 = angular.module("myApp", ['myApp2']);
app1.controller('firstController',function($scope){
$scope.name='张三';
// $("#obj1").html('<span>尿道嗦嘎电视柜 v邓先生广东省高</span>');
var obj1=document.getElementById('obj1');
angular.element(obj1).html('这是angularjs中的jqlite');
});
</script>
</body>
</html>

angularjs1-3,工具方法,bootstrap,多个module,引入jquery的更多相关文章

  1. jquery源码解析:jQuery延迟对象Deferred(工具方法)详解1

    请先看上一课的回调对象.Deferred是通过extend添加到jQuery中的工具方法.如下所示: jQuery.extend({ Deferred: function( func ) { }, w ...

  2. angularjs工具方法

    1.angular.extend var dst = {name: 'xxx', country: 'China'}; var src1 = {name: 'yyy', age: 10}; var s ...

  3. angular的工具方法笔记(equals, HashKey)

    分别是angular脏值检测的工具方法equals和 类HashKey的使用方法 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transi ...

  4. 秒味课堂Angular js笔记------Angular js中的工具方法

    Angular js中的工具方法 angular.isArray angular.isDate angular.isDefined angular.isUndefined angular.isFunc ...

  5. JQuery操作类数组的工具方法

    JQuery学习之操作类数组的工具方法 在很多时候,JQuery的$()函数都返回一个类似数据的JQuery对象,例如$('div')将返回div里面的所有div元素包装的JQuery对象.在这中情况 ...

  6. jQuery工具方法

    目录 常用工具方法 判断数据类型的方法 Ajax操作 $.ajax 简便写法 Ajax事件 返回值 JSONP 文件上传 参考链接 jQuery函数库提供了一个jQuery对象(简写为$),这个对象本 ...

  7. jQuery晦涩的底层工具方法们

    这里整理的是jQuery源码中一些比较晦涩难懂的.内部的.最底层的工具方法,它们多为jQuery的上层api方法服务,目前包括: jQuery.access jQuery.access: functi ...

  8. zepto源码学习-02 工具方法-详细解读

    上一篇:地址 先解决上次留下的疑问,开始看到zepto.z[0]这个东西的时候,我很是不爽,看着它都不顺眼,怎么一个zepto的实例对象var test1=$('#items');  test__pr ...

  9. jQuery源代码 解析一 工具方法

    1. 外层沙箱以及命名空间$ 几乎稍微有点经验前端人员都这么做,为了避免声明了一些全局变量而污染,把代码放在一个"沙箱执行",然后在暴露出命名空间(可以为API,函数,对象): 2 ...

  10. Underscore.js 常用类型判断以及一些有用的工具方法

    1. 常用类型判断以及一些有用的工具方法 underscore.js 中一些 JavaScript 常用类型检查方法,以及一些工具类的判断方法. 首先我们先来谈一谈数组类型的判断.先贴出我自己封装好的 ...

随机推荐

  1. css要点

    1.对inline-block设置overflow: hidden会造成baseline移动,因此需要设置vertical-align才不会出现样式问题. 2.使用flex时,需要对设置flex: 1 ...

  2. Fiddler-AutoResponder 修改接口数据

    问题 App 功能测试时,有些场景需要特殊的数据,如 App 对极限值的处理:或是账单列表的时间需要显示刚刚.昨天.周几,需要接口返回不同的时间.更改数据库是一种方法,但不够灵活,一些复杂的场景也不好 ...

  3. echarts 纵坐标数字太长显示补全,以及文字倾斜显示

    如上数字太长,显示补全,以及x坐标的月份当数量大的时候也会显示补全: x可以调节纵坐标label的宽度 y2可以调节横坐标label的高度 grid: { x: 100, //默认是80px y: 6 ...

  4. 查看linux机器cpu、内存环境信息

    2C2G,4C4G,8C16G,16C32G 这里C指cpu物理核数,G指总内存大小 # 查看物理CPU个数 cat  /proc/cpuinfo| grep "physical id&qu ...

  5. 熟悉VS2017 和Github 第二次作业

    GIT地址 https://github.com/Astone1213 GIT用户名  Astone1213 学号后五位  62114 博客地址 https://www.cnblogs.com/AsL ...

  6. 机器学习PAI快速入门

    什么是机器学习? 机器学习(Machine Learning, ML)是一门多领域交叉学科,涉及概率论.统计学.逼近论.凸分析.算法复杂度理论等多门学科.专门研究计算机怎样模拟或实现人类的学习行为,以 ...

  7. swap空间可以有效缓解内存压力

    不太了解底层的人对swap空间的概念也很模糊,这里我简单举例,看看swap空间的作用 查看当前swap空间:3个方式 [root@localhost /home/xxx/kirin/os_diagno ...

  8. [USACO08FEB]修路Making the Grade 动态规划

    对的\(n^3\)的程序调了一个月了,惊了... HSZ学oi\(\Longleftrightarrow\)闭眼学oi 要不是翻旧账还看不见.. 这是有\(n^2\)做法的. 参见LYD的书P244 ...

  9. java实现QQ空间模拟登录

    import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import j ...

  10. IntelliJ IDEA 2017.1.6 x64 的破解

    方式一 现在用这个 http://idea.imsxm.com/好使 步骤如下,点击help按钮,选择Register 点击license server   修改下面的服务器激活地址 方式二 由于Je ...