ember-2.0 尖括号组件不适用于 ember-cli@0.2.7

ember-2.0 angle-bracket component not working with ember-cli@0.2.7

请问我还需要什么才能让 ember-2.0 尖括号组件与最新的 ember-cli

一起工作

我正在使用 ember-cli 0.27、nodejs 0.12.4 和 emberjs-canary分支测试 emberjs-2.0.

我创建了一个简单的新 ember 应用程序:

  ember new test-app

并创建了一个组件:

    ember g component my-test

在application.hbs中如果我添加下面这行调用组件,组件中的内容不显示。

    <my-test  />

如果把上面一行改成下面一行,就会显示组件的内容。

{{my-test}}

这是我的bower.json

的摘录
    {
      "name": "em",
      "dependencies": {
         "ember": "components/ember#canary",
         "ember-data": "components/ember-data#canary",,
         "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
         "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
         "ember-data": "1.0.0-beta.18",
         "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4",
         "ember-qunit": "0.3.3",
          "ember-qunit-notifications": "0.0.7",
          "ember-resolver": "~0.1.15",
          "jquery": "^1.11.1",
         "loader.js": "ember-cli/loader.js#3.2.0",
         "qunit": "~1.17.1"
   },
   "resolutions": {
       "ember": "canary",
       "ember-data": "canary"
     }
   }

这是我的包裹,json

  "devDependencies": {
     "broccoli-asset-rev": "^2.0.2",
     "ember-cli": "0.2.7",
     "ember-cli-app-version": "0.3.3",
     "ember-cli-babel": "^5.0.0",
     "ember-cli-content-security-policy": "0.4.0",
     "ember-cli-dependency-checker": "^1.0.0",
     "ember-cli-htmlbars": "0.7.6",
     "ember-cli-ic-ajax": "0.1.1",
     "ember-cli-inject-live-reload": "^1.3.0",
     "ember-cli-qunit": "0.3.13",
     "ember-cli-uglify": "^1.0.1",
     "ember-data": "1.0.0-beta.18",
     "ember-disable-proxy-controllers": "^1.0.0",
     "ember-export-application-global": "^1.0.2"
  }

此时,该功能仍处于功能标记之后。因此必须启用适当的标志。

功能标志在 config/environment.js 中启用,在您的情况下,它应该看起来有点像:

 ...
 EmberENV: {
  FEATURES: {
    'ember-htmlbars-attribute-syntax': true,
    'ember-htmlbars-inline-if-helper': true,
    'ember-htmlbars-component-generation': true
  }
 }

示例 config/environment.js -> https://github.com/stefanpenner/ember-jobs/blob/master/config/environment.js#L17

另供参考: * 功能标志指南:http://guides.emberjs.com/v1.10.0/configuring-ember/feature-flags/