Angular-auto-validate 项目教程
1. 项目的目录结构及介绍
angular-auto-validate/
├── dist/
│ ├── jcs-auto-validate.min.js
│ └── jcs-auto-validate.min.js.map
├── src/
│ ├── directives/
│ ├── services/
│ ├── validators/
│ └── jcs-auto-validate.js
├── test/
│ ├── unit/
│ └── e2e/
├── bower.json
├── package.json
├── README.md
└── LICENSE
- dist/: 包含编译后的 JavaScript 文件,主要是
jcs-auto-validate.min.js
。 - src/: 项目的源代码目录,包含指令、服务、验证器等。
- test/: 包含单元测试和端到端测试。
- bower.json: Bower 包管理文件。
- package.json: npm 包管理文件。
- README.md: 项目说明文档。
- LICENSE: 项目许可证。
2. 项目的启动文件介绍
项目的启动文件主要是 src/jcs-auto-validate.js
,这个文件是 Angular-auto-validate 模块的主入口文件。它定义了模块并包含了所有必要的指令和服务。
(function() {
'use strict';
angular
.module('jcs-autoValidate', []);
})();
3. 项目的配置文件介绍
项目的配置文件主要是 bower.json
和 package.json
。
bower.json
{
"name": "angular-auto-validate",
"version": "1.20.0",
"description": "An automatic validation module for AngularJS which gets rid of excess html in favour of dynamic element modification to notify the user of validation errors",
"main": "dist/jcs-auto-validate.min.js",
"authors": [
"Jon Samwell <jon.samwell@gmail.com>"
],
"license": "MIT",
"keywords": [
"angularjs",
"validation",
"auto",
"form",
"validate"
],
"homepage": "https://github.com/jonsamwell/angular-auto-validate",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
package.json
{
"name": "angular-auto-validate",
"version": "1.20.0",
"description": "An automatic validation module for AngularJS which gets rid of excess html in favour of dynamic element modification to notify the user of validation errors",
"main": "dist/jcs-auto-validate.min.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jonsamwell/angular-auto-validate.git"
},
"keywords": [
"angularjs",
"validation",
"auto",
"form",
"validate"
],
"author": "Jon Samwell <jon.samwell@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/jonsamwell/angular-auto-validate/issues"
},
"homepage": "https://github.com/jonsamwell/angular-auto-validate#readme"
}
这两个文件定义了项目的元数据、依赖关系和脚本命令。bower.json
用于 Bower 包管理,而 package.json
用于 npm 包管理。