- 2
- 0
- 约1.14万字
- 约 9页
- 2017-05-26 发布于湖北
- 举报
angular常用指令课案
angular 常用指令
已经用了angular很久积累了一些很实用的指令,需要的话直接拿走用,有问题大家一起交流
1.focus时,input:text内容全选
angular.module(my.directives).directive(autoselect, [function () {
return {
restrict: A,
link: function (scope, element, attr) {
if (element.is(input) attr.type === text) {
var selected = false;
var time = parseInt(attr[autoselect]);
element.bind(mouseup, function (e) {
if (selected) {
e.preventDefault();
e.stopPropagation();
}
原创力文档

文档评论(0)