Ember component - Explicit declaration of parameters in the component

Im kinda new in Ember world.

When working with a large library of unknown components, Im having difficulties tracking what params they accept.

Let's put an fake example:

Template ViewA

{{component-article
    title="article.title"
    preview="article.preview"
    image="article.imgUrl"
    content="article.content"}}

Template ViewB

{{component-article
    title="article.title"
    content="article.content"}}

As we see, two templates are using my component-article component.

My issue comes when I want to use this component. How do i know the properties my **component-article is exposing?**

If Im Im new to the project, I have never seen nor use component-article, I have no idea what properties is accepting. In fact, I need to dig into the template, do a find in the project and see how others templates are calling it or what not.

Is there any way to explicitly set in the component-article.js file what properties Im allowing to come in?

The positionalParams property seems to almost serve this purpose but it does not.

Is there any property in the component that would allow me to set explicitly what params are accepted by the component? Any convention on this?

Example:

export default Component.extend({
  layout,
  acceptProperties: ['title', 'content', 'preview', 'image']
});


#ember.js

2 Likes2.20 GEEK