In learning the awesome Aurelia
framework, I have learnt that you can use the following composition techniques however I am not sure what would be the difference.
<compose view="./nav-bar.html"></compose>
or
<require from="./nav-bar.html"></require>
Any clarification is appreciated.
<require>
imports resources that you want to use in the view. It's conceptually similar to a require()
JavaScript call in AMD or CommonJS module code (or an import
statement in ES6 code). You would use <require>
to import a custom element or custom attribute that you wanted to use in your view. You'll still need to explicitly render it like <nav-bar></nav-bar>
.
<compose>
renders the specified view.
We will use already created templates in our app and we need to use in the current app via require. you can use css and javscript files also in require. But from compose you can render your views by giving your view modal name.
You can see this link to have a better idea about compose.
http://patrickwalters.net/best-parts-of-aurelia-1-composing-custom-elements-templates/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With