mercredi 5 septembre 2018

How to use function with arguments in ember.js template - Handlebar

Currently Im trying to use a function that observes a field of a controller/component in ember template (handlebars).

index.hbs


   <span>This field is required</span>


index.js

hasFieldError: function(val) {
   return true if val is found in an array
}.observes('field1'),

But this of course returns a build error:

{#if hasFieldError('compa ----------------------^ Expecting 
'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 
'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 
'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', got 'INVALID'

Any idea how to achieve this?




Aucun commentaire:

Enregistrer un commentaire