Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-async-validator

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-async-validator - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

angular-async-validator.d.ts

1

angular-async-validator.js

@@ -334,1 +334,2 @@ var AsyncValidator;

})(AsyncValidator || (AsyncValidator = {}));
module.exports = AsyncValidator;

4

bower.json
{
"name": "angular-async-validator",
"version": "0.1.0",
"version": "0.2.0",
"homepage": "https://github.com/pocesar/angular-async-validator",

@@ -25,3 +25,3 @@ "authors": [

"description": "This module enables you to register your own validation rules, or overwrite existing ones. Makes every validation 'promise based', so it can deal with both synchronous and asynchronous validations. Also, sometimes you want validate an entire form when a model changes, which currently there are no good ways to do this, hence this module, because validation and form manipulation in Angular 1.x is a pain by itself.",
"main": "angular-async-validator.js",
"main": "angular-async-validator.umd.js",
"license": "MIT",

@@ -28,0 +28,0 @@ "ignore": [

{
"name": "angular-async-validator",
"version": "0.1.0",
"version": "0.2.0",
"description": "This module enables you to register your own validation rules, or overwrite existing ones. Makes every validation 'promise based', so it can deal with both synchronous and asynchronous validations. Also, sometimes you want validate an entire form when a model changes, which currently there are no good ways to do this, hence this module, because validation and form manipulation in Angular 1.x is a pain by itself.",

@@ -8,3 +8,3 @@ "main": "index.js",

"test": "karma start tests/karma.conf.js",
"compile": "tsc --noImplicitAny --module commonjs typings/tsd.d.ts angular-async-validator.ts",
"compile": "tsc --noImplicitAny --module commonjs --target es5 --declaration typings/tsd.d.ts angular-async-validator.ts && umd AsyncValidator angular-async-validator.js --commonJS > angular-async-validator.umd.js",
"travis": "karma start tests/karma.conf.js --single-run --browsers PhantomJS"

@@ -14,9 +14,11 @@ },

"coveralls": "2.x",
"karma": "^0.12.31",
"karma": "0.12.x",
"karma-cli": "x",
"mocha": "2.x",
"karma-coverage": "0.x",
"karma-mocha": "0.x",
"karma-phantomjs-launcher": "0.x",
"karma-sinon": "^1.0.4",
"sinon": "^1.14.1"
"karma-sinon": "1.x",
"sinon": "1.x",
"umd": "3.x"
},

@@ -23,0 +25,0 @@ "keywords": [

@@ -175,3 +175,20 @@ [![Build Status](https://travis-ci.org/pocesar/angular-async-validator.svg?branch=master)](https://travis-ci.org/pocesar/angular-async-validator) [![Coverage Status](https://coveralls.io/repos/pocesar/angular-async-validator/badge.svg)](https://coveralls.io/r/pocesar/angular-async-validator)

```html
<input async-validator-watch="'ctrl.hasChanged'" async-validator="'$model.$viewValue != ctrl.data.value'" ng-model="data.n6" type="text">
<input
async-validator-watch="'ctrl.hasChanged'"
async-validator="'$model.$viewValue != ctrl.data.value'"
ng-model="data.n6"
type="text"
>
<input
async-validator-watch="ctrl.data"
async-validator="'$model.$viewValue != ctrl.data.value'"
ng-model="data.n6"
type="text"
>
<input
async-validator-watch="['ctrl.data','ctrl.hasChanged']"
async-validator="'$model.$viewValue != ctrl.data.value'"
ng-model="data.n6"
type="text"
>
```

@@ -204,4 +221,14 @@

<form async-validator-form="{ required: 'required', dummy: 'ctrl.controllerValidation($value)' }">
<input type="email" name="email" ng-model"ctrl.data.email"> <!-- value will have to pass required and dummy validators -->
<input type="tel" ng-model"ctrl.data.phone" async-validator-add> <!-- value will have to pass required and dummy validators -->
<input
type="email"
name="email"
ng-model"ctrl.data.email">
<!-- value will have to pass Angular internal required and our registered dummy validator -->
<input
type="tel"
ng-model"ctrl.data.phone"
async-validator-add
>
<!-- value will have to pass Angular internal required and our registered dummy validator -->
</form>

@@ -214,6 +241,10 @@ ```

* `valueFrom` where to get the current value. Defaults to `undefined`, and passes the whole ngModelController to the validator function as the first parameter
* `valueFrom` where to get the current value. Defaults to `false`, and passes the whole ngModelController to the validator function as the first parameter. You can set to model properties like `$viewValue`, `$modelValue`, `$$lastCommittedViewValue`, `$$rawModelValue`, etc
* `options` any options that the validator function receives as the second parameter, defaults to `{}`
* `overwrite` if you set to false, it will throw if there's another validator with same name, defaults to `true`
* `removeSync` will not remove synchronous validators if they have the same name, defaults to `false` (removes validators with same name)
* `removeSync` removes synchronous validators if they have the same name as your registered validator, defaults to `true`. Eg: using `<input ng-model="model" required async-validator="'required'">` will delete the default `required` validator
* `silentRejection` if sets to false, will rethrow the error. will turn any throws and rejections into an "invalid" validation, defaults to true.

@@ -220,0 +251,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc