angular-input
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<script src="http://localhost:81/js/jquery.js">
</script>
<script src="http://localhost:81/js/angular.min.js">
</script>
<body ng-app="Demo">
<div ng-controller="TestCtrl">
<input type="text" ng-model="a" test />
<button ng-click="show(a)">查看</button>
</div>
</body>
<script>
var app = angular.module('Demo', [], angular.noop);
app.directive('test', function(){
//input 指令的 link有第四个参数,$ctrl有些方法,你可以自己拿来用
var link = function($scope, $element, $attrs, $ctrl){
console.log( $ctrl )
$ctrl.$formatters.push(function(value){
return value.join(',');
}); $ctrl.$parsers.push(function(value){
return value.split(',');
});
} return {compile: function(){return link},
require: 'ngModel',
restrict: 'A'}
}); app.controller('TestCtrl', function($scope){
$scope.a = [];
//$scope.a = [1,2,3];
$scope.show = function(v){
console.log(v);
}
}); </script>
</html>
angular-input的更多相关文章
- angular input标签只能单向传递数据的问题
angularjs input标签只能单向传递数据的问题 <ion-view title = "{{roomName}}" style = "height:90%; ...
- Angular Input格式化
今天在Angular中文群有位同学问到:如何实现对input box的格式化.如下的方式对吗? <input type="text" ng-model="demo. ...
- 【转】Angular Input格式化
今天在Angular中文群有位同学问到:如何实现对input box的格式化.如下的方式对吗? <input type="text" ng-model="demo. ...
- angular input使用输入框filter格式化日期
最近使用angular日期选取器.只需要把所选的输出迄今input输入框,根据默认的假设,显示是在时间的形式的时间戳.不符合规定.需要格成一个特定的公式格公式.但input上ng-model不能直接对 ...
- angular input 为file on-change 无效
l转自:https://blog.csdn.net/klo220/article/details/53331229 侵删 出现这个问题是因为input的type是file,这时如果用ng-change ...
- angular input=file ng-change事件
首先 ng-change事件要与ng-model绑定 但是 当input 的 type=file时 ngchange事件是失效的 我们可以用图中的onchange事件去代替 其次 如果想在这 ...
- angular input file 上传文件
<body > <div ng-controller="fileCtrl"> <form ng-submit="submit(obj)&qu ...
- Angular input / ion-input ion-searchbar 实现软件盘换行 改 搜索 并且触发搜索方法 Android iOS适用
Angular 实现软件盘 换行 改 搜索 并且除非 搜索方法: Form 必须有 action="javascript: return true;” input / ion-in ...
- Angular @Input讲解及用法
1.什么是@input @input的作用是定义模块输入,是用来让父级组件向子组件传递内容. 2.@input用法 首先在子组件中将需要传递给父组件的变量用@input()修饰 需要在子组件ts文件i ...
- angular input框点击别处 变成不可输入状态
<input type="text" ng-model="edit" ng-disabled="!editable" focus-me ...
随机推荐
- 简单谈谈RAID
RAID是“Redundant Array of Independent Disk”的缩写,翻译过来叫做独立磁盘的冗余阵列,其实就是磁盘的存储.访问.备份技术.在谈RAID之前,先简单学习一下存储器的 ...
- 修改镜像文件EI.CFG
一.EI.cfg说明 Windows 7 安装光盘中存在着 SOURCES\EI.CFG 这样一个配置文件.EI.cfg 是特定于 Windows 安装程序的配置文件,用于确定在安装过程中应该使用哪种 ...
- C++STL之迭代器
迭代器 迭代器提供对一个容器中的对象的访问方法,并且定义了容器中对象的范围.迭代器就如同一个指针.事实上,C++的指针也是一种迭代器.但是,迭代器不仅仅是指针,因此你不能认为他们一定具有地址值.例如, ...
- [转]jQuery Popup Login and Contact Form
本文转自:http://www.formget.com/jquery-popup-form/ Pop up forms are the smart way to present your site. ...
- runc的detach, console, tty等相关问题
runc 端解析: 1. runc/utils_linux.go func (r *runner) run(config *specs.Process) (int , error) 在该函数中第一次对 ...
- TDD in Expert Python Programmin
Test-Driven Development PrinciplesTDD consists of writing test cases that cover a desired feature, t ...
- AC日记——信息传递 洛谷 P2661 (tarjan求环)
题目描述 有n个同学(编号为1到n)正在玩一个信息传递的游戏.在游戏里每人都有一个固定的信息传递对象,其中,编号为i的同学的信息传递对象是编号为Ti同学. 游戏开始时,每人都只知道自己的生日.之后每一 ...
- IO流的练习2 —— 复制单级文件夹中的文件
需求:把C:\Users\Administrator\Desktop\记录\测试里面的所有文件复制到 C:\Users\Administrator\Desktop\新建文件夹\copy文件夹中 分析: ...
- js文本框提示和自动完成
1.模仿大型网站自动提示,就是输入“苹果”,在水果类中搜索,html代码如下: <div id="searchTips" style="display:none;w ...
- Chrome 开发工具 Javascript 调试技巧
http://www.w3cplus.com/tools/dev-tips.html 一.Sources 面板介绍: Sources 面板分为左中右 3 部分左:Sources 当前页面加载的资源列表 ...