[AngularJS] angular-schema-form -- 1
Check out on gitHub, see the example on Demo page, see the document, extension.
Mainly, there are three parts consist of Javascript part:
form, schema and model.
Schema :
I like define the schema first. Usually you will use two props:
type, properties & required.
{
"type": "object",
"title": "Somehting ele",
"properties": {
"email": {
"title": "Email",
"type": "string",
"pattern": "^\\S+@\\S+$",
"description": "Email will be used for evil."
}
},
"required": [
"email"
]
}
In 'properties', is the place where you define the form elements. For example - "email".
Form:
Then in the form, if you thing the schema setting is ok, then in form:
[
"email"
]
Also you can overwrite the form: for example, I want to over the title, add a placeholder.
{
"key": "email",
"type": "string",
"title": "Email filed",
"placeholder": "Email"
}
"key" in the example matchs to the "email" in the shcema.
A good example for input field:
Schema:
"email": {
"title": "Email",
"type": "string",
"pattern": "^\\S+@\\S+$",
"maxlength": 120,
"minlength": 3,
"validationMessage": "This is not an email"
"description": "Email will be used for evil."
}
Form:
{
"key": "email",
"type": "string",
"title": "Email filed",
"placeholder": "Email"
}
Standard Options for form:
{
key: "address.street", // The dot notatin to the attribute on the model
type: "text", // Type of field
title: "Street", // Title of field, taken from schema if available
notitle: false, // Set to true to hide title
description: "Street name", // A description, taken from schema if available, can be HTML
validationMessage: "Oh noes, please write a proper address", // A custom validation error message
onChange: "valueChanged(form.key,modelValue)", // onChange event handler, expression or function
feedback: false, // Inline feedback icons
placeholder: "Input...", // placeholder on inputs and textarea
ngModelOptions: { ... }, // Passed along to ng-model-options
readonly: true, // Same effect as readOnly in schema. Put on a fieldset or array
// and their items will inherit it.
htmlClass: "street foobar", // CSS Class(es) to be added to the container div
fieldHtmlClass: "street" // CSS Class(es) to be added to field input (or similar)
}
[AngularJS] angular-schema-form -- 1的更多相关文章
- angular reactive form
这篇文章讲了angular reactive form, 这里是angular file upload 组件 https://malcoded.com/posts/angular-file-uploa ...
- [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 ...
- angular实现form验证
先上效果页面:https://lpdong.github.io/myForm-1/ 其中几个知识点 1.angularJs提供了几个新的type类型: type="password" ...
- [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 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 ...
- [Angular] Reactive Form -- FormControl & formControlName, FormGroup, formGroup & formGroupName
First time dealing with Reactive form might be a little bit hard to understand. I have used Angular- ...
- [Angularjs]angular ng-repeat与js特效加载先后导致的问题
写在前面 最近在项目中遇到这样的一个前端的bug,在ng-repeat中绑定的图片,有一个晃动的特效,在手机端浏览的时候,图片有时候会正常展示,有时就展示不出来.当时猜测是因为angularjs与特效 ...
- angular.js form
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- [Angular2 Form] Create and Submit an Angular 2 Form using ngForm
Forms in Angular 2 are essentially wrappers around inputs that group the input values together into ...
随机推荐
- 在Linux上运行C#
众所周知,C#是Microsoft推出的.NET语言,只能在.NET平台上运行,例如Win 9x.ME.NT.2000.XP和Win CE之类的操作系统.但是,现在却有了一个叫做Mono的项目,它的目 ...
- Web打印控件smsx.cab使用说明
在项目开发中,经常会用到页面打印的功能,在ASP.NET环境下推荐一款web打印控件smsx.cab. 使用方法:一般会先定义一个用于打印的母版页(Print.Master),在母版页上做好布局 ...
- bzoj1003: [ZJOI2006]物流运输
dp+最短路.暴力枚举就可以了.O(n3logn).样例中m=n然后测样例过了.然后 54行习惯性的dis[n]然后就WA了!!!. #include<cstdio> #include&l ...
- Java多态中的注意事项
1.“覆盖”私有方法 public class PrivateOverride { private void f() { print("private f()"); } publi ...
- NET下RabbitMQ实践[示例篇]
在上一篇文章中,介绍了在window环境下安装erlang,rabbitmq-server,以免配置用户,权限,虚拟机等内容. 今天将会介绍如果使用rabbitmq进行简单的消息入队, ...
- NopCommerce架构分析之八------多语言
系统支持的语言是有类:Language表示: 多语言资源对应的类为:LocalizedProperty: 当先选择某种语言存储在类中:GenericAttribute: 多语言可以导出为XML文件,当 ...
- HDU 2121 Ice_cream’s world II 最小树形图
这个题就是需要求整个有向带权图的最小树形图,没有指定根,那就需要加一个虚根 这个虚根到每个点的权值是总权值+1,然后就可以求了,如果求出来的权值大于等于二倍的总权值,就无解 有解的情况,还需要输出最根 ...
- HDU 1255 覆盖的面积 线段树+扫描线
同 POJ1151 这次是两次 #include <iostream> #include <algorithm> #include <cstdio> #includ ...
- 恒天云技术分享系列6 – vLan网络原理解析
转载自恒天云官网:http://www.hengtianyun.com/download-show-id-15.html Vlan网络模式优点 增加网络可扩展性 网络隔离,每个租户拥有独立的网络及vl ...
- HDU-2262 Where is the canteen 概率DP,高斯消元
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2262 题意:LL在一个迷宫里面转,每次走向周围能走的点的概率都是一样的,现在LL要随机的走到cante ...