发表于: 2016-08-12 23:08:04
0 2327
今天完成的事情:
1、函数声明 function name (){} 函数表达式name = function(){}
两者一视同仁。
编译器执行时会先执行函数声明再执行代码。
函数表达式只在编译器执行到所在行才会编译他,如果调用在函数表达式前面,会报错。
2、js遍历点击输出index值
var btn = document.getElementsByTagName("button");
for (var i = 0,aa =btn.length ; i < aa ;i++) {
btn[i].aaa = i
btn[i].onclick = function () {
this.style.color="red"
alert(this.aaa)
};
}
3、了解指令的基本用法
// 指令测试
$scope.aaa = "123"
$scope.bbb = "456"
});
// 指令测试
angular.module("myApp")
.directive('first',function () {
var directive = {};
directive.restrict = 'E';
// directive.template = "My first directive:{{vm.listdata[0].name}}";
directive.templateUrl = "/view/directivePage.html";
directive.scope = {
user:"=user"
};
return directive;});
<div>
<!--指令测试-->
<first user="aaa">this will be replaced</first>
<first user="bbb">this will be replaced</first>
</div>
明天计划的事情:
1、9-10点回日报。
2、10-12点看一看自己的笔记。
3、准备把以前写的东西,用angular重构一遍。
遇到的问题:
以前写的东西,忘了怎么写的。
收获:
无
评论