ember-cli-simple-validation
Advanced tools
Comparing version 0.3.2 to 0.4.0
{ | ||
"name": "ember-cli-simple-validation", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "ember-cli addon that provides simple form validation", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -25,5 +25,22 @@ # ember-cli-simple-validation | ||
## Installation | ||
## Installation with ember-data (or vanilla ember object) | ||
``` | ||
1) npm install ember-cli-simple-validation --save-dev | ||
2) add isDirty computed for the field you validate (username example below) | ||
``` | ||
```js | ||
Ember.Object.extend({ | ||
username: null, | ||
usernameIsDirty: false, | ||
usernameChanged: function () { | ||
this.set("usernameIsDirty", true); | ||
}.observes("username") | ||
}); | ||
``` | ||
## Installation with ember-cli-simple-store | ||
``` | ||
1) remove ember-data from your package.json file | ||
@@ -76,3 +93,3 @@ 2) remove ember-data from your bower.json file | ||
The last step is to add a true model object and declare each field. | ||
The last step is to add a true model object and declare each field | ||
@@ -102,3 +119,3 @@ ```js | ||
3) The mixin will add a computed property called "valid" that you can use to confirm each field is valid | ||
4) The model needs to support dirty tracking at the field level (ember-cli-simple-store provides the model and dirty tracked attribute) | ||
4) The model needs to support dirty tracking at the field level (ember-cli-simple-store provides the model and dirty tracked attribute but ember-data and ember object will work if you add the isDirty computed) | ||
5) The css class that is added to the span is "hidden" | ||
@@ -105,0 +122,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10138741
176