Reputation: 728
I would like to know what's the difference between using custom elements or custom attributes in Aurelia.
I am using a datepicker from jqueryUI. I implemented it as a custom attribute(following this https://www.danyow.net/jquery-ui-datepicker-with-aurelia/) and it works perfectly. I wasn't able to make it into a custom element tough. I looked around and found some examples online but they didn't work.
I want to know if there are any disadvantages to using custom attributes in place of custom elements.
Upvotes: 2
Views: 318
Reputation: 1040
A custom attribute is for extending the functionality of an existing HTML Element and actually have no view. Like in your example you want to extend the functionality of an input field. It shall look like an input, have standard focus/form/validation etc. input behaviour and so on ( if <input type="date"/>
would be proper implemented in all browser we would surely use this instead of jquery-datepicker ).
custom elements are a possibility to write your own reusable element inclusive an own view and own functionality and logic.
Examples:
custom element
custom attribute
Upvotes: 6