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的更多相关文章

  1. [Angularjs]angular ng-repeat与js特效加载先后导致的问题

    写在前面 最近在项目中遇到这样的一个前端的bug,在ng-repeat中绑定的图片,有一个晃动的特效,在手机端浏览的时候,图片有时候会正常展示,有时就展示不出来.当时猜测是因为angularjs与特效 ...

  2. [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 ...

  3. [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 ...

  4. [AngularJS] Angular 1.3 Anuglar hint

    Read More: http://www.linkplugapp.com/a/953215 https://docs.google.com/document/d/1XXMvReO8-Awi1EZXA ...

  5. [AngularJS] Angular 1.3 ng-model-options - getterSetter

    getterSetter:  boolean value which determines whether or not to treat functions bound to ngModel as ...

  6. [AngularJS] Angular 1.3: ng-model-options updateOn, debounce

    <!DOCTYPE html> <html ng-app="app"> <head lang="en" > <meta ...

  7. AngularJs angular.identity和angular.noop详解

    angular.identity 函数返回本身的第一个参数.这个函数一般用于函数风格. ----------以上是官网对该接口的说明,只能说这个文档写得也太二,让人完全看不懂.要理解它的用途,可直接看 ...

  8. AngularJs angular.Module模块接口配置

    angular.Module Angular模块配置接口. 方法: provider(name,providerType); name:服务名称. providerType:创建一个服务的实例的构造函 ...

  9. AngularJs Angular数据类型判断

    angular.isArray 判断括号内的值是否为数组. 格式:angular.isArray(value); value: 被判断是否为数组的值. ------------------------ ...

随机推荐

  1. 【web安全】第一弹:利用xss注入获取cookie

    首先一定要先来吐槽一下tipask系统.这是一枚开源的类似百度知道的系统,但是漏洞多多,最基本的XSS注入都无法防御. 言归正传: [准备1] cookie接收服务器. 平时喜欢用sae,所以在sae ...

  2. ZOJ 2562 More Divisors

    又是个水题,刚刚开始没有用搜索,因为对于反素数有: n=2^t1*3^t2^5^t3*7^t4..... 这里有 t1>=t2>=t3>=t4. 而且相同的因数的情况下,素数越不同越 ...

  3. 算法练习之:Biorhythms

    Biorhythms Time Limit: 1000MS Memory Limit: 10000KB  Problem Description Some people believe that th ...

  4. 测试用(编写优质嵌入式C程序)

    注:相比于Word,如果使用CSDN自带编辑器写出结构清晰的文档,需要花费更多的时间,所以我尝试将我写的一些word文档转换为图片发布,这样就可以保持原来的结构.字体,可以获得更好的可读性.图片的分辨 ...

  5. AsyncHttpClient 开源框架學習研究

    转载请注明出处:http://blog.csdn.net/krislight OverView: AsyncHttpClient庫 基於Apache的HttpClient框架,是一個異步的httpCl ...

  6. ExecutorService生命周期

    ExecutorService接口继承了Executor接口,定义了一些生命周期的方法 public interface ExecutorService extends Executor { void ...

  7. 【SSSP】A forward-backward single-source paths algorithm

    0. 引子基础的算法和数据结构已经学习的差不多了,上学期期末就打算重点研究研究STOC和FOCS上面的论文.做这件事情的初衷是了解别人是如何改进原有算法的,搞清楚目前比较热的算法问题有哪些,更重要的是 ...

  8. bzoj1406

    这道题很有意思 我们解过线性同余方程,也解过同余方程 这个则是求x^2≡1 (mod p) 可以将问题转化为(x-1)(x+1)≡0 (mod p) 然后我们穷举一下p的约数i, 看i|x-1,p/i ...

  9. jQuery对象和DOM对象原来不一样啊

    jQuery对象和DOM对象使用说明,需要的朋友可以参考下.1.jQuery对象和DOM对象第一次学习jQuery,经常分辨不清哪些是jQuery对象,哪些是 DOM对象,因此需要重点了解jQuery ...

  10. PHP 'ext/soap/php_xml.c'不完整修复多个任意文件泄露漏洞

    漏洞版本: PHP 5.4.1 PHP 5.3.13 PHP 5.3.12 PHP 5.3.11 PHP 5.3.10 PHP 5.3.1 PHP 5.3 漏洞描述: BUGTRAQ ID: 6237 ...