Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lifeart/ember-ref-modifier

Ember Ref Modifier
https://github.com/lifeart/ember-ref-modifier

ember ember-addon ember-addons modifier

Last synced: about 1 month ago
JSON representation

Ember Ref Modifier

Awesome Lists containing this project

README

        

# ember-ref-modifier

[![Greenkeeper badge](https://badges.greenkeeper.io/lifeart/ember-ref-modifier.svg)](https://greenkeeper.io/)

------------

## Check [ember-ref-bucket](https://github.com/lifeart/ember-ref-bucket) first!

**`ember-ref-modifier`** likely will be **deprecated** after **`ember-ref-bucket`** major release

------------

An implementation of the `{{ref}}` element modifier.
Heavily inspired by [ember-on-modifier](https://github.com/buschtoens/ember-on-modifier) and [`@ember/render-modifiers`](https://github.com/emberjs/ember-render-modifiers).

## Installation

```
ember install ember-ref-modifier
```

#### Compatibility

- Ember.js v3.13 or above
- ember-cli v2.13 or above

## Usage

```hbs

Click me baby, one more time!

{{this.button.dataset.name}} >> "foo"
```

--------------------------

```hbs

Click me baby, one more time!

```

```js
class Component {
@action callback(node) {
this.node = node;
}
}

```

------------------------

```hbs


{{#-in-element this.divContainer}}
Hello!
{{/-in-element}}
```
------------------------

```hbs
// hash helper must return an EmberObject! The default hash helper returns a pojo.
{{#let (hash) as |ctx|}}

Enter your name
{{/let}}
```

------------------------

------

```hbs

Click me baby, one more time!

```

```ts
import Component from '@ember/component';

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

This is essentially equivalent to:

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

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