How to use ember-modifier - 1 common examples

To help you get started, we’ve selected a few ember-modifier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hashicorp / consul / ui / packages / consul-ui / app / modifiers / disabled.js View on Github external
import { modifier } from 'ember-modifier';

export default modifier(function enabled($element, [bool = true], hash) {
  if (['input', 'textarea', 'select', 'button'].includes($element.nodeName.toLowerCase())) {
    if (bool) {
      $element.disabled = bool;
    } else {
      $element.dataset.disabled = false;
    }
    return;
  }
  for (const $el of $element.querySelectorAll('input,textarea')) {
    if ($el.dataset.disabled !== 'false') {
      $el.disabled = bool;
    }
  }
});

ember-modifier

A library for writing Ember modifiers

MIT
Latest version published 6 months ago

Package Health Score

78 / 100
Full package analysis

Popular ember-modifier functions