James Lam
James Lam

Reputation: 1269

EmberJS Handle Bars Inputs

I have the following:

         <span>{{m.search_type}}</span>
          {{input value=m.search_type}}

I retrieve the search_type with

this.get(search_type) in the controller that handles the form submission.

However, when I change the input value, the value within the <span>..</span> will change. This is the defined behavior in the docs.

I want the span to be the title for the input field and to not change along with the value of search_type. Search type is dynamic so I can't just hardcode the value for {{m.search_type}}.

Is there a way to do this? I tried creating a EmberJS Helper to map the value to a new string but this still changes whenever search_type changes.

Upvotes: 0

Views: 38

Answers (1)

jadnco
jadnco

Reputation: 81

Properties are always bound by default. Use the unbound helper to unbind the property.

<span>{{unbound m.search_type}}</span>

{{input value=m.search_type}}

Upvotes: 2

Related Questions