| 1 |
import { helper } from '@ember/component/helper'; |
| 2 |
import { modifier } from 'ember-modifier'; |
| 3 |
|
| 4 |
const plusOne = helper(([num]) => num + 1); |
| 5 |
|
| 6 |
const setScrollPosition = modifier((element, [position]) => { |
| 7 |
element.scrollTop = position |
| 8 |
}); |
| 9 |
|
| 10 |
<template> |
| 11 |
<div class="scroll-container" {{setScrollPosition @scrollPos}}> |
| 12 |
{{#each @items as |item index|}} |
| 13 |
Item #{{plusOne index}}: {{item}} |
| 14 |
{{/each}} |
| 15 |
</div> |
| 16 |
</template> |
| 17 |
|
| 18 |
# From https://github.com/ember-template-imports/ember-template-imports |
| 19 |
|