kogosoftwarellc / angular-async-form Goto Github PK
View Code? Open in Web Editor NEWAsync form handling the angular way.
License: MIT License
Async form handling the angular way.
License: MIT License
cb
is called with an error for the checkboxed input.cb
is called with an error for the radio input.If an input is hidden and used to collect a computed value from another input(s), an async form error associated with the hidden input does not clear automatically when its value is updated (blur must be triggered manually).
In my opinion, inputs validated by async form should only show the error based on $valid
/$invalid
state of the model, thus not requiring blur/change events.
function link(scope, el) {
scope.$watch('input1', function(value) {
$timeout(function() {
scope.$apply(function() {
input2.$setViewValue(value)
// if async error exists, error will not be hidden
// despite this model being $valid
})
}, 0, false)
})
function link(scope, el) {
var input2el
$timeout(function() {
input2el = angular.element(el.find('input2'))
})
scope.$watch('input1', function(value) {
$timeout(function() {
scope.$apply(function() {
input2.$setViewValue(value)
input2el.triggerHandler('blur')
// async error will now get cleared
})
}, 0, false)
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.