machty / emblem.js

Emblem.js - Ember-friendly, indented syntax alternative for Handlebars.js
http://emblemjs.com
MIT License
1.04k stars 81 forks source link

Can't get component binded attribute value #280

Closed polarlights closed 8 years ago

polarlights commented 8 years ago

I'm newer for ember and emblem. Today, I learn by the ember.js official tutorial with emblem, I got something wired:

The official tutorial is here: https://guides.emberjs.com/v2.4.0/tutorial/autocomplete-component

My code:


| City: 
input value=value keyUp='autoComplete'

button{action 'search'} Search

ul
  = each filteredList as |item|
    li{action 'choose' item.city} #{item.city}
import Ember from 'ember';

export default Ember.Component.extend({
  value: null,
  filteredList: null,
  actions: {
    autoComplete() {
      console.log(this.get('value'));
      this.get('autoComplete')(this.get('value'));
    },
    search() {
      this.get('search')(this.get('value'));
    },
    choose(city) {
      this.set('filter', city);
    }
  }
});

However, in I got a null value for the this.get('value')。Am I wrong OR it's a bug?

In addition, the code in .hbs {{input value=value key-up=(action 'autoComplete')}} should be input value=value keyUp='autoComplete' in .emblem? Some syntax at http://emblemjs.com/syntax/ seems to be out-dated, for example link-to should be = link-to in ember 2.0+。

Thank you in advance.

polarlights commented 8 years ago

It should be =input value=value key-up=(action 'autoComplete')