Can't import helper functions to use functions from Components or Controllers
See original GitHub issueIt would be really cool to be able to access these functions from my component logic rather than having to write new, redundant helpers.
Can the library be updated to export each of the helper functions so that I can import them like so:
import { ltHelper } from 'ember-truth-helpers/helpers/lt';
would allow me to access functions like ltHelper
in my js code?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
How to use a helper function in a controller? - Stack Overflow
I would use a helper in a Controller Component for generalization and using in many controllers.... – Pipo. Oct 8, 2013 at 22:06....
Read more >Importing Utility Functions in React.js - Pluralsight
Importing Utility Functions in React.js ... Start off by creating the component called BTCDollarConverter which looks like the following:.
Read more >Not able to call a helper function from a javascript controller in ...
I have implemented an application in which I have two different buttons. As you can see I am calling two different helper methods...
Read more >Helper Functions - Components - Ember Guides
Helper functions are JavaScript functions that you can call from your template. ... import { helper } from '@ember/component/helper'; function ...
Read more >apex - I have two helper functions that are the exact same, one ...
So I have many of these, 10 to be exact and three won't execute, they are all the exact same and I feel...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Primarily, but not exclusively. If I have to recreate the exact functionality of what a helper is doing as a controller or component function, then the helper is no longer DRY, reusable code, but duplicative code.
In the Ember slack channel I asked if Ember allowed for loading helper functions into other modules. @rwjblue answered that it should and recommended that I create a ticket here so we could look into what was happening. So that’s what I did.
If the answer is
won't fix
, that’s fine.because there is no
<
operator in Handlebars and helpers are primarily meant to be used in templates