Block form component


(James Cook) #1

I’m attempting my first plugin and have come across this in the codebase:

{{#discovery-categories refresh="refresh"}}
  {{component categoryPageStyle
              categories=model.categories
              latestTopicOnly=latestTopicOnly
              topics=model.topics}}
{{/discovery-categories}}

I’ve done some basic Ember recently, but haven’t come across the {{#name}} syntax yet.

I learnt to use components like (without the hash in the name):

{{component-name}}

Does the hash/pound symbol represent anything special? Is it even a component? And why is the categoryPageStyle component being called with ‘component’ in front of it?

Thanks!


(cpradio) #2

Yes, and the # denotes block form (instead of inline)
https://guides.emberjs.com/v2.5.0/components/wrapping-content-in-a-component/


(James Cook) #3

Thanks for your help @cpradio


(James Cook) #4

I’m also assuming that components can exist without having their own template file? (As there doesn’t appear to be one for discovery-categories.)

This is something I was also unaware of!


(cpradio) #5

Yes, it depends how the component is built and what it is extending (if anything).

Example of using Buffered Render

Versus one that is utilizing a template