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,遇到的 ...
随机推荐
- MySQL 5.7 解压版安装配置
测试环境 系统:Windows 10专业版 版本:MySQL Server 5.7.14 提纲 修改配置文件 初始化 安装服务.启动服务 修改root密码 步骤 1.解压安装包 在MySQL官 ...
- css3 文字过长用...代替
white-space: nowrap; text-overflow: ellipsis; overflow: hidden; white-space:nowrap 代表多个空格/回车不换行: tex ...
- iOS开发 二维码生成
基于libqrencode的二维码生成 + (void)drawQRCode:(QRcode *)code context:(CGContextRef)ctx size:(CGFloat)size { ...
- angularjs 下拉框
@{ Layout = null;} <!DOCTYPE html> <html><head> <meta name="viewport" ...
- Ubuntu中由root用户修改为普通用户的办法
比如你的普通用户名是test 目前是root用户 键入命令 su - test 就可以了
- Synchronized快
/* JAVA对于多线程的安全问题提供了专业的解决方式 就是同步代码块 synchronized(对象)//这个对象可以为任意对象 { 需要被同步的代码 } 对象如同锁,持有锁的线程可以在同步中执行 ...
- tensorflow版的bvlc模型
研究相关的图片分类,偶然看到bvlc模型,但是没有tensorflow版本的,所以将caffe版本的改成了tensorflow的: 关于模型这个图: 下面贴出通用模板: from __future__ ...
- 在VC++6.0开发中实现全屏显示
全屏显示是一些应用软件程序必不可少的功能.比如在用VC++编辑工程源文件或编辑对话框等资源时,选择菜单“View\Full Screen”,即可进入全屏显示状态,按“Esc”键后会退出全屏显示状态. ...
- c#数据绑定(4)——向查询中添加参数
本实例主要练习了ADO.Net 连接到外部数据库的基础上,向查询中添加参数.使用的是ACCESS数据库. 在ACCESS数据库中可以用MSSQL的形式定义操作字符串,也可以采用OLEDB的形式. MS ...
- 前端面试题2016--CSS
介绍一下标准的CSS的盒子模型?低版本IE的盒子模型有什么不同的? (1)有两种,IE 盒子模型.W3C 盒子模型:(2)盒模型:内容(content).填充(padding).边界(margin). ...