What is the difference between <compose> and <require> in Aurelia?

Studying the amazing structure Aurelia, I found out that you can use the following composition methods, but I'm not sure there will be a difference.

<compose view="./nav-bar.html"></compose>

or

<require from="./nav-bar.html"></require>

Any clarification is appreciated.

+4
source share
2 answers

<require>imports the resources you want to use in the view. It is conceptually similar to calling JavaScript require()in AMD or CommonJS module code (or in an expression importin ES6 code). You must use <require>to import a custom item or custom attribute that you would like to use in your view. You still need to explicitly display it as <nav-bar></nav-bar>.

<compose> .

+8

Source: https://habr.com/ru/post/1618747/


All Articles