angularjs ng-click
在angularjs的controller中一段代码,展示如下:
var sortList = new SortList();
sortList.setSorts([$scope.year_invest_sort]);
$scope.sorts = sortList.getSorts();
$scope.bySort = function(sortListItem){
if(sortListItem.sort == '0'){
sortList.setSorts([$scope.year_invest_sort_rise]);
}else if(sortListItem.sort == '1'){
sortList.setSorts([$scope.year_invest_sort_drop]);
}else if(sortListItem.sort == '2'){
sortList.setSorts([$scope.year_invest_sort]);
}
}
$scope.sorts = sortList.getSorts();
html页面div中有个ng-click="bySrot(1)",点击之后sortList是什么?
这样写的话sortList仍然是$scope.year_invest_sort,没有达到想要的结果$scope.year_invest_sort_drop,因为最后一行代码$scope.sorts = sortList.getSorts()
没有执行,应该写到方法里面才能执行得到想要的结果。看似简单,也容易忽视。略记录下。
angularjs ng-click的更多相关文章
- Part 6 AngularJS ng repeat directive
ng-repeat is similar to foreach loop in C#. Let us understand this with an example. Here is what we ...
- part 4 AngularJS ng src directive
- Part 15 AngularJS ng init directive
The ng-init directive allows you to evaluate an expression in the current scope. In the following e ...
- table sorting–angularjs
1: <script type="text/javascript" ng:autobind 2: src="http://code.angularjs.org/0. ...
- angularjs 的笔记
angular.copy()深拷贝 angular提供了一个可以复制对象的api--copy(source,destination),它会对source对象执行深拷贝. 使用时需要注意下面几点: 如果 ...
- 从angularJS看MVVM
javascript厚积薄发走势异常迅猛,导致现在各种MV*框架百家争雄,MVVM从MVC演变而来,为javascript注入了全新的活力.我工作的业务不会涉及到angularJS[ng]这么重量级的 ...
- [译]用AngularJS构建大型ASP.NET单页应用(三)
原文地址:http://www.codeproject.com/Articles/808213/Developing-a-Large-Scale-Application-with-a-Single A ...
- angularJS看MVVM
从angularJS看MVVM javascript厚积薄发走势异常迅猛,导致现在各种MV*框架百家争雄,MVVM从MVC演变而来,为javascript注入了全新的活力.我工作的业务不会涉及到a ...
- js架构设计模式——从angularJS看MVVM
javascript厚积薄发走势异常迅猛,导致现在各种MV*框架百家争雄,MVVM从MVC演变而来,为javascript注入了全新的活力.我工作的业务不会涉及到 angularJS[ng] 这么重量 ...
- angularJS中$apply()方法详解
这篇文章主要介绍了angularJS中$apply()方法详解,需要的朋友可以参考下 对于一个在前端属于纯新手的我来说,Javascript都还是一知半解,要想直接上手angular JS,遇到的 ...
随机推荐
- Python notes
1. range()函数的使用: a = range(n) # a = range(0,n) b = range(m,n) # b = range(m,n) alist = list(a) # ali ...
- 推荐6款常用的Java开源报表制作工具
JasperReports是一个基于Java的开源报表工具,它可以在Java环境下像其它IDE报表工具一样来制作报表.JasperReports 支持PDF.HTML.XLS.CSV和XML文件输出格 ...
- appml的安装与使用
来自w3cshool的中文文档:http://www.w3cschool.cc/appml/appml-tutorial.html 我们要做的是完整的例子,所以从这里http://www.w3csch ...
- CSS3--transform
transform:向元素应用2D或3D转换,该属性允许我们对属性旋转,缩放,移动,或倾斜. transfrom:none:定义不进行转换 transfrom:matrix(n,n,n,n,n,n); ...
- C语言课程学习的总结
C语言课程学习的总结 学习C程序这门课一年了,这是我们学的第一门专业课.在大学里,C语言不但是计算机专业的必修课程而且也是非计算机专业学习计算机基础的一门必修课程.所以作为我这个计算机专业的学生来说当 ...
- 解决: org.iq80.leveldb.DBException: IO error: C:\data\trie\000945.sst: Could not create random access file.
以太坊MPT树的持久化层是采用了leveldb数据库,然而在抽取MPT树代码运行过程中,进行get和write操作时却发生了错误: Caused by: org.fusesource.leveldbj ...
- mysql自增主键归零的方法
最近老是要为现在这个项目初始化数据,搞的很头疼,而且数据库的Id自增越来越大,要让自增重新从1开始:那么就用下面的方法吧:方法一: 如果曾经的数据都不需要的话,可以直接清空所有数据,并将自增字段恢复从 ...
- Oracle TnsName问题记录
在多次oracle服务器搭建过程中,经常遇到tnsname不正确的情况1.安装了client 这个时候XX/client/network/admin/中也有一个tnsname,而且在环境变量中,系统是 ...
- linux head、tail、sed、cut、grep、find
head用法: head 参数 文件名 -cn:显示前n个字节 -n:显示前n行 例子:head -c20 1.txt 显示1.txt文件中前20个字符 ls | head -20:显示前20 ...
- Python 修饰符
def hello(fn): def wrapper(): print "hello" fn() print "goodb ...