[AngularJS] angular-formly: Extending Types
Extending types is one of the ways that makes angular-formly help you keep your Angular forms DRY. When use responsibly, they can make it much easier to manage common types, allowing you to add a bit of functionality to a common type.
(function() {
'use strict';
var app = angular.module('formlyExample', ['formly', 'formlyBootstrap']);
app.run(function(formlyConfig) {
formlyConfig.setType({
name: 'avengersSelect',
extends: 'select',
defaultOptions: {
templateOptions: {
label: 'Favorite Avenger',
options: [
{name: 'Iron Man', value: 'iron_man'},
{name: 'Captain America', value: 'captain_america'},
{name: 'Black Widow', value: 'black_widow'},
{name: 'Hulk', value: 'hulk'},
{name: 'Thor', value: 'thor'}
]
}
}
});
})
app.controller('MainCtrl', function MainCtrl($timeout) {
var vm = this;
vm.model = {};
vm.fields = [
{
type: 'avengersSelect',
key: "avengersSelect"
},
{
type: 'avengersSelect',
key: "avengersSelect2",
templateOptions: {
label: 'Favorite Avenger 2',
options: [
{name: 'Iron Man', value: 'iron_man'},
{name: 'Captain America', value: 'captain_america'},
{name: 'Black Widow', value: 'black_widow'},
{name: 'Hulk', value: 'hulk'},
{name: 'Thor', value: 'thor'}
]
}
}
];
});
})();
[AngularJS] angular-formly: Extending Types的更多相关文章
- [Angularjs]angular ng-repeat与js特效加载先后导致的问题
写在前面 最近在项目中遇到这样的一个前端的bug,在ng-repeat中绑定的图片,有一个晃动的特效,在手机端浏览的时候,图片有时候会正常展示,有时就展示不出来.当时猜测是因为angularjs与特效 ...
- [AngularJS] Angular 1.3 ngMessages with ngAnimate
Note: Can use $dirty to check whether user has intracted with the form: https://docs.angularjs.org/a ...
- [AngularJS] Angular 1.3 $submitted for Form in Angular
AngularJS 1.3 add $submitted for form, so you can use $submitted to track whether the submit event ...
- [AngularJS] Angular 1.3 Anuglar hint
Read More: http://www.linkplugapp.com/a/953215 https://docs.google.com/document/d/1XXMvReO8-Awi1EZXA ...
- [AngularJS] Angular 1.3 ng-model-options - getterSetter
getterSetter: boolean value which determines whether or not to treat functions bound to ngModel as ...
- [AngularJS] Angular 1.3: ng-model-options updateOn, debounce
<!DOCTYPE html> <html ng-app="app"> <head lang="en" > <meta ...
- AngularJs angular.identity和angular.noop详解
angular.identity 函数返回本身的第一个参数.这个函数一般用于函数风格. ----------以上是官网对该接口的说明,只能说这个文档写得也太二,让人完全看不懂.要理解它的用途,可直接看 ...
- AngularJs angular.Module模块接口配置
angular.Module Angular模块配置接口. 方法: provider(name,providerType); name:服务名称. providerType:创建一个服务的实例的构造函 ...
- AngularJs Angular数据类型判断
angular.isArray 判断括号内的值是否为数组. 格式:angular.isArray(value); value: 被判断是否为数组的值. ------------------------ ...
随机推荐
- CocoaPods简单使用
CocoaPods的原理 CocoaPods的原理是将所有的依赖库都放到另一个名为Pods的项目中,然后让主项目依赖Pods项目,这样,源码管理工作都从主项目移到了Pods项目中.Pods项目最终会编 ...
- 百度预测 及 maven pom搜索地址
http://trends.baidu.com/ http://mvnrepository.com/artifact/net.sourceforge.htmlcleaner/htmlcleaner/2 ...
- 制作qtopia-2.2.0和qt4文件系统
转自 rootfs_qtopia_qt4.img 1. 解压rootfs_qtopia_qt4-20100816.tar.gz,得到目录rootfs_qtopia_qt4,里面内容比较大,超过了64M ...
- phpStorm 配置关联php手册
phpStorm 配置关联php手册 pasting php开发中我尝试过很多个编辑器,但用的最多的是phpStorm ,但一直因为英文太烂,很多phpStorm功能,都没用过.. 最近发现有些编辑器 ...
- 【BZOJ 1233】 [Usaco2009Open]干草堆tower (单调队列优化DP)
1233: [Usaco2009Open]干草堆tower Description 奶牛们讨厌黑暗. 为了调整牛棚顶的电灯的亮度,Bessie必须建一座干草堆使得她能够爬上去够到灯泡 .一共有N大包的 ...
- Android 4.0设计规范 优先导读 十大改变
在拜读和翻译了 Android design 设计指导后,对比 Android 4.0 与 Android2.3 及之前版本的 app 设计指导,总结了 Android 4.0 设计的 10 大改变: ...
- bzoj2285
完全是为了拼凑才出出来的吧先分数规划求出到基地入口的最小安全系数然后再最小点权覆盖集,只不过这里是带一定精度实数的流,其实是一样的 ; eps=0.001; type way=record po,ne ...
- BZOJ3188: [Coci 2011]Upit
3188: [Coci 2011]Upit Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 72 Solved: 24[Submit][Status] ...
- 尚未在 Web 服务器上注册 ASP.NET 4.0” 的解决办法
http://www.sowsoy.com/topics-537.html win7,vs2010创建.NetFramework 4框架下的Asp.Net空网站.系统提示 “尚未在 Web 服务器上注 ...
- Cocos2d-x学习之windows 7的visual studo 2010开发环境安装
1.引擎代码的下载 官方版本地址为: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download 目前最新版本是cocos2d-2.0-rc0a ...