admin 管理员组

文章数量: 1086019

The Glimmer website states:

Just drop your Glimmer ponents into an Ember app. You won’t need to change a thing.

I’ve been following the official Ember quick start tutorial. I replaced the contents of the generated people-list.js ponent with this:

import Component from '@glimmer/ponent';

export default class PeopleList extends Component {

}

and I get an error in the browser console stating that @glimmer/ponent is undefined. After I run yarn add @glimmer/ponent to add the dependency, I get a new error from Broccoli.

Additionally, whenever I use '@' before a variable in the people-list.hbs template, the template fails to pile. How do I get the Glimmer ponent to work in my Ember app?

The Glimmer website states:

Just drop your Glimmer ponents into an Ember app. You won’t need to change a thing.

I’ve been following the official Ember quick start tutorial. I replaced the contents of the generated people-list.js ponent with this:

import Component from '@glimmer/ponent';

export default class PeopleList extends Component {

}

and I get an error in the browser console stating that @glimmer/ponent is undefined. After I run yarn add @glimmer/ponent to add the dependency, I get a new error from Broccoli.

Additionally, whenever I use '@' before a variable in the people-list.hbs template, the template fails to pile. How do I get the Glimmer ponent to work in my Ember app?

Share Improve this question edited Mar 31, 2017 at 7:02 locks 6,57734 silver badges39 bronze badges asked Mar 29, 2017 at 16:31 Ludovico FischerLudovico Fischer 1,60211 silver badges11 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

To use glimmer in an ember app today (May 1st, 2019),

yarn add --dev @glimmer/ponent@beta

then

import Component from '@glimmer/ponent';
import { tracked } from '@glimmer/tracking';

export default class MyComponent extends Component {
  @tracked number = 0;

  increment() {
    this.number++;
  }
}

to see this in action, take a look at a fresh Octane App: https://github./ember-cli/ember-octane-blueprint

Currently you can't use it for existing ember app. but you can try it brand new app. By installing ember new my-glimmer-app -b https://github./glimmerjs/glimmer-blueprint.git

If you go with yarn global add ember-cli/ember-cli this way then you need to uninstall existing ember-cli (npm uninstall -g ember-cli)

本文标签: javascriptHow do I use Glimmer components inside an Ember appStack Overflow