Skip to content

Instantly share code, notes, and snippets.

@alexdiliberto
Created October 27, 2015 04:13
Show Gist options
  • Save alexdiliberto/18f90991db5b1f1b8aee to your computer and use it in GitHub Desktop.
Save alexdiliberto/18f90991db5b1f1b8aee to your computer and use it in GitHub Desktop.
Wierd tricks you can stop using in Ember 2.0
Wierd tricks you can stop using in Ember 2.0
{{! Input component with Error handling }}
{{input value=(mut (get model field))}}
{{#each (get model (concat "errors." field)) as |error|}}
{{error}}
{{/each}}
instead of
```js
import Unicorn from 'my-app/lib/unicorn';
//...
container.register('magical:unicorn', Unicorn);
```
You can simply let the ember resolver do the work for You and move the file to 'my-app/magical/unicorn'...
Now the Unicorn class with automatically be available inside the container at "magical:unicorn"
OR even better
Just make the unicorn file a service, then we don't need to do container.inject...we can just inject.service on the application route
Helpers are chronically underused. Don't be afraid to move old CP logic into new Helpers
In some cases with glimmer there is a performance gain with this Helper approach
Architecture: Loading Templates + Immediate On-Screen Content: http://jsbin.com/coqofe/edit?html,js,output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment