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

co-form-util

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-form-util - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

client-src/example/app.module.js

2

client-src/error-message.component.js

@@ -18,3 +18,3 @@ "use strict";

this.errorTriggered = false;
this.wait = true;
this.wait = false;
}

@@ -21,0 +21,0 @@ ErrorMessageComponent.prototype.ngOnInit = function () {

@@ -18,4 +18,4 @@ import {Component, Input} from '@angular/core'

public errorTriggered = false
public wait = true
public errorTriggered = false;
public wait = false;

@@ -22,0 +22,0 @@ ngOnInit () {

@@ -27,2 +27,5 @@ "use strict";

forms_1.Validators.maxLength(10)
]],
myColor: ['', [
forms_1.Validators.required
]]

@@ -32,3 +35,12 @@ });

AppComponent.prototype.submitMyForm = function (myForm) {
console.log(myForm);
if (!myForm.valid) {
Object.keys(myForm.controls).forEach(function (controlKey) {
myForm.controls[controlKey].markAsDirty();
myForm.controls[controlKey].updateValueAndValidity();
});
alert('please fix validation errors');
}
else {
alert('form submission ok');
}
};

@@ -44,3 +56,3 @@ AppComponent = __decorate([

styles: ["\n .ng-valid {\n border-left: 5px solid #42A948; /* green */\n }\n\n .ng-invalid {\n border-left: 5px solid #a94442; /* red */\n }\n "],
template: "\n <div class=\"container\">\n <h3>Form util examples</h3>\n <form [formGroup]=\"myForm\" novalidate (ngSubmit)=\"submitMyForm(myForm)\">\n <div class=\"row\">\n <div class=\"col-xs-4\">\n <input-wrap [control]=\"myForm.controls.myName\" [timeout]=\"1000\">\n <label class=\"form-control-label\">Name</label>\n <input type=\"text\" class=\"form-control form-control-danger\" formControlName=\"myName\">\n <error-message [control]=\"myForm.controls.myName\" [trigger]=\"'required'\">\n Required\n </error-message>\n <error-message [control]=\"myForm.controls.myName\" [trigger]=\"'minlength'\"\n [timeout]=\"1000\">\n Minimum 5 characters\n </error-message>\n <error-message [control]=\"myForm.controls.myName\" [trigger]=\"'maxlength'\"\n [textClass]=\"'text-warning'\">\n Maximum 10 characters\n </error-message>\n </input-wrap>\n </div>\n <div class=\"col-xs-4\">\n </div>\n <div class=\"col-xs-4\">\n <button type=\"submit\" class=\"btn btn-success\">\n Submit\n </button>\n </div>\n </div>\n </form>\n </div>\n "
template: "\n <div class=\"container\">\n <h3>Form util examples</h3>\n <form [formGroup]=\"myForm\" novalidate (ngSubmit)=\"submitMyForm(myForm)\">\n <div class=\"row\">\n <div class=\"col-xs-4\">\n <input-wrap [control]=\"myForm.controls.myName\" [timeout]=\"1000\">\n <label class=\"form-control-label\">Name</label>\n <input type=\"text\" class=\"form-control form-control-danger\" formControlName=\"myName\">\n <error-message [control]=\"myForm.controls.myName\" [trigger]=\"'required'\">\n Required\n </error-message>\n <error-message [control]=\"myForm.controls.myName\" [trigger]=\"'minlength'\"\n [timeout]=\"1000\">\n Minimum 5 characters\n </error-message>\n <error-message [control]=\"myForm.controls.myName\" [trigger]=\"'maxlength'\"\n [textClass]=\"'text-warning'\">\n Maximum 10 characters\n </error-message>\n </input-wrap>\n </div>\n <div class=\"col-xs-4\">\n <input-wrap [control]=\"myForm.controls.myColor\">\n <label class=\"form-control-label\">Color</label>\n <input type=\"text\" class=\"form-control form-control-danger\"\n formControlName=\"myColor\">\n <error-message [control]=\"myForm.controls.myColor\" [trigger]=\"'required'\">\n Required\n </error-message>\n </input-wrap>\n </div>\n <div class=\"col-xs-4\">\n <label class=\"form-control-label\">&nbsp;</label><br>\n <button type=\"submit\" class=\"btn btn-success\">\n Submit\n </button>\n </div>\n </div>\n </form>\n </div>\n "
}),

@@ -47,0 +59,0 @@ __metadata('design:paramtypes', [forms_1.FormBuilder])

@@ -48,4 +48,13 @@ import {Component, OnInit} from '@angular/core'

<div class="col-xs-4">
<input-wrap [control]="myForm.controls.myColor">
<label class="form-control-label">Color</label>
<input type="text" class="form-control form-control-danger"
formControlName="myColor">
<error-message [control]="myForm.controls.myColor" [trigger]="'required'">
Required
</error-message>
</input-wrap>
</div>
<div class="col-xs-4">
<label class="form-control-label">&nbsp;</label><br>
<button type="submit" class="btn btn-success">

@@ -71,2 +80,5 @@ Submit

Validators.maxLength(10)
]],
myColor: ['', [
Validators.required
]]

@@ -77,4 +89,12 @@ })

public submitMyForm (myForm) {
console.log(myForm)
if (!myForm.valid) {
Object.keys(myForm.controls).forEach(controlKey => {
myForm.controls[controlKey].markAsDirty()
myForm.controls[controlKey].updateValueAndValidity()
})
alert('please fix validation errors')
} else {
alert('form submission ok')
}
}
}

@@ -15,3 +15,3 @@ "use strict";

this.timeout = 0;
this.wait = true;
this.wait = false;
}

@@ -18,0 +18,0 @@ InputWrapComponent.prototype.ngOnInit = function () {

@@ -15,3 +15,3 @@ import {Component, Input} from '@angular/core'

public wait = true;
public wait = false;

@@ -18,0 +18,0 @@ ngOnInit () {

{
"name": "co-form-util",
"version": "1.0.1",
"version": "1.0.2",
"description": "Angular 2: Model driven form utils",

@@ -24,3 +24,5 @@ "main": "index.js",

},
"keywords": ["angular2"],
"keywords": [
"angular2"
],
"author": "Carl-Ola Boketoft",

@@ -32,9 +34,13 @@ "license": "ISC",

"homepage": "https://github.com/calleboketoft/co-form-util#readme",
"peerDependencies": {
"@angular/core": "^2.0.0-rc.5",
"@angular/forms": "^0.3.0"
},
"devDependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/forms": "^0.2.0",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/forms": "0.3.0",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"bootstrap": "git+https://git@github.com/twbs/bootstrap.git#v4-dev",

@@ -44,6 +50,6 @@ "es6-shim": "0.35.1",

"ghooks": "1.3.2",
"reflect-metadata": "0.1.3",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.36",
"typescript": "1.8.10",
"typescript": "2.0.0",
"typings": "1.3.2",

@@ -50,0 +56,0 @@ "zone.js": "0.6.12"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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