Calling a function in a logo conditional expression

How can we call the function with parameters in the logo conditional. How I have a function:

priorExist: (prior) ->
      @get("priors").findBy("condition", prior)

      

But I get an error when I call it an emblem like this

if priorExist(name)

      

Is there a way to call the function in the logo?

+3


source to share


1 answer


Above functionality can be achieved using Ember components Like this

Component if-existing-prior-component.coffee/js

App.IfExistingPriorComponent = Ember.Component.extend(existingPrior: (->
  @get("param2").findBy("condition", @get("param1"))
).property("param1"))

      

if-existing-pre Template



if existingPrior
  = yield

      

Then we can use the above component for comparison in our logo like this:

if-existing-prior param1=name param2=priors

      

Where priors = @get("priors")

+4


source







All Articles