简体   繁体   English

Ember Engines组件不呈现内容

[英]Ember Engines Component does not render content

I inherited an ember application and can't figure out how to add a component to an engine. 我继承了余烬应用程序,无法弄清楚如何向引擎添加组件。

I tried to create the component with: 我尝试使用以下方法创建组件:

web-app$ ember g component about-profile -ir fs-engine
installing component
  create lib/fs-engine/addon/components/about-profile.js
  create lib/fs-engine/addon/templates/components/about-profile.hbs
installing component-test
  create tests/integration/components/about-profile-test.js
installing component-addon
  create lib/fs-engine/app/components/about-profile.js

I then added the following to lib/fs-engine/addon/templates/components/about-profile.hbs 然后,我将以下内容添加到lib / fs-engine / addon / templates / components / about-profile.hbs

<article>
  <h1>Test</h1>
  <p>Please work</p>
</article>

I try to invoke this component at the template file lib/fs-engine/addon/templates/gw/itemdetail.hbs 我尝试在模板文件lib / fs-engine / addon / templates / gw / itemdetail.hbs中调用此组件

<div>{{about-profile}}</div>

It returns empty. 它返回空。 Nothing is rendered. 什么都没有呈现。 No error messages are displayed anywhere. 没有错误消息显示在任何地方。

I am sure I am missing something very basic since I am new to Ember but I did read Ember Engines guide ( http://ember-engines.com/guide ) and Ember Component guide ( https://guides.emberjs.com/v2.12.0/components/defining-a-component/ ). 我确信我是Ember的新手,所以我已经错过了一些非常基本的东西,但是我确实阅读了Ember Engines指南( http://ember-engines.com/guide )和Ember Component指南( https://guides.emberjs.com/ v2.12.0 / components / defining-a-component / )。

thanks for your help! 谢谢你的帮助!

as it turns out, I was able to resolve this issue by stopping "ember server" and then restarting it after creating the component. 事实证明,我能够通过停止“ ember服务器”并在创建组件后重新启动它来解决此问题。 simple as that! 就那么简单!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM