-
-
Save dmitry-ilyashevich/6125299 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class KoModel | |
indexed_error_for: (property_name, index, nested_property = null) => | |
ko.computed => | |
return unless @errors() and error_property = @errors()[property_name] | |
error = jQuery.grep error_property, (item) -> | |
item.index == index | |
return '' unless error and error.length | |
if nested_property | |
@join_errors error[0].errors[nested_property] | |
else | |
@join_errors error[0].errors | |
error_for: (property_name) => | |
ko.computed => | |
@join_errors @errors()[property_name] if @errors()? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment