module FormAngular::Errors::NgError
Public Instance Methods
has_html_error()
click to toggle source
# File lib/form_angular/errors/ng_error.rb, line 19 def has_html_error ng_error.present? end
html_options(key)
click to toggle source
# File lib/form_angular/errors/ng_error.rb, line 23 def html_options(key) html_options ||= {} html_options.merge!({'ng-show' => "#{ng_access_expression}.$error.#{key} && (#{ng_access_expression}.$invalid || #{ng_access_expression}.$dirty)", class: "ng-cloak text-danger"}) end
ng_error(wrapper_options)
click to toggle source
# File lib/form_angular/errors/ng_error.rb, line 8 def ng_error(wrapper_options) error_tags = "" error_tags = template.content_tag(:span, "{{errors['#{tag_name}'].server}}", html_options("server")) if @options[:ng_errors] @options[:ng_errors].each do |validate_key| error_tags += template.content_tag(:span, I18n.t("activerecord.errors.#{lookup_model_names.last}.#{attribute_name}.#{validate_key}"), html_options(validate_key)) end end error_tags end