Socket
Socket
Sign inDemoInstall

ember-ref-modifier

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-ref-modifier

{{ref propName context}} element modifier


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ember-ref-modifier

Greenkeeper badge

An implementation of the {{ref}} element modifier. Heavily inspired by ember-on-modifier and @ember/render-modifiers.

Installation

ember install ember-ref-modifier
Compatibility
  • Ember.js v2.18 or above
  • ember-cli v2.13 or above

Usage

<button {{ref this "button"}} data-name="foo">
  Click me baby, one more time!
</button>

{{this.button.dataset.name}} >> "foo"
<div {{ref this "divContainer" }}></div>
{{#-in-element this.divContainer}}
  Hello!
{{/-in-element}}
// hash helper must return an EmberObject!
{{#let (hash) as |ctx|}}
	<input id="name-input" {{ref ctx 'inputNode'}}>
	<label for={{ctx.inputNode.id}}> Enter your name </label>
{{/let}}

<button {{ref this "button"}}>
  Click me baby, one more time!
</button>
import Component from '@ember/component';

export default class BritneySpearsComponent extends Component {
  button!: DOMNode
}

This is essentially equivalent to:

didInsertElement() {
  super.didInsertElement();
  this.set('button', this.element.querySelector('button'));
}

It will also re-register property, if any of the passed parameters change.

Deprecations

Old syntaxis {{ref 'pathName' context}} will be deprecated in version 1.0.0.

Use {{ref context 'pathName'}} instead.

Keywords

FAQs

Package last updated on 17 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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