ui-validate Build Status npm version Bower version Join the chat at https://gitter.im/angular-ui/ui-validate

General-purpose validator for ngModel.

Angular.js comes with several built-in validation mechanism for input fields (ngRequired, ngPattern etc.) but using an arbitrary validation function requires creation of a custom formatters and / or parsers. The ui-validate directive makes it easy to use any function(s) defined in scope as a validator function(s). A validator function will trigger validation on both model and input changes.

Requirements

  • AngularJS

Usage

You can get it from Bower

bower install angular-ui-validate

Load the script files in your application:

<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/angular-ui-validate/dist/validate.js"></script>

Add the specific module to your dependencies:

angular.module('myApp', ['ui.validate', ...])

Development

We use Karma and jshint to ensure the quality of the code. The easiest way to run these checks is to use grunt:

npm install -g gulp-cli
npm install && bower install
gulp

The karma task will try to open Firefox and Chrome as browser in which to run the tests. Make sure this is available or change the configuration in karma.conf.js

Gulp watch

gulp watch will automatically test your code and build a release whenever source files change.

How to release

Use gulp to bump version, build and create a tag. Then push to GitHub:

gulp release [--patch|--minor|--major]
git push --tags origin master # push everything to GitHub

Travis will take care of testing and publishing to npm's registry (bower will pick up the change automatically). Finally create a release on GitHub from the tag created by Travis.



ui-validate Build Status npm version Bower version Join the chat at https://gitter.im/angular-ui/ui-validate

ngModel的通用验证器。

Angular.js带有几个内置的输入字段验证机制(ngRequired,ngPattern等),但使用 任意验证功能需要创建自定义格式化器和/或解析器。 ui-validate指令使得可以使用范围中定义的任何函数作为验证器函数。 验证器功能将触发模型和输入更改的验证。

要求

  • AngularJS

用法

您可以从 Bower 获得

bower install angular-ui-validate

将应用程序中的脚本文件加载到

<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/angular-ui-validate/dist/validate.js"></script>

将特定模块添加到依赖关系中:

angular.module('myApp', ['ui.validate', ])

开发

我们使用Karma和jshint来确保代码的质量。运行这些检查的最简单方法是使用grunt:

npm install -g gulp-cli
npm install && bower install
gulp

业务任务将尝试打开Firefox和Chrome作为运行测试的浏览器。确保这可用或更改 karma.conf.js

中的配置

Gulp手表

gulp watch 将自动测试您的代码,并在源文件更改时构建一个版本。

如何释放

使用gulp来破坏版本,构建和创建标签。然后推送到GitHub:

gulp release [–patch|–minor|–major]
git push –tags origin master # push everything to GitHub

Travis将负责测试和发布到npm的注册表(bower将自动接收更改)。最后,从Travis创建的标签在GitHub上创建一个版本




相关问题推荐