No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Interfaces
Object-oriented languages, such as Java, support the concept of an interface that defines a set of method signatures. A class that implements the interface must provide the method implementations. An interface in Java can't be instantiated directly, but a class that implements the interface can.
Similarly, the Lightning Component framework supports the concept of interfaces that define a component's shape by defining its attributes.
Since there are fewer restrictions on the content of abstract components, they are more common than interfaces. A component can implement multiple interfaces but can only extend one abstract component, so interfaces can be more useful for some design patterns.
An interface starts with the <aura:interface> tag. It can only contain <aura:attribute> tags that define the interface's attributes. You can't use markup, renderers, controllers, models or anything else in an interface.
To use an interface, you must implement it or add a provider. An interface can't be used directly in markup otherwise. Set the implements system attribute in the <aura:component> tag to the name of the interface that you are implementing. For example:
1<aura:component implements="mynamespace:myinterface" >A component can implement an interface and extend another component.
1<aura:component extends="ns1:cmp1" implements="ns2:intf1" >An interface can extend multiple interfaces using a comma-separated list.
1<aura:interface extends="ns:intf1,ns:int2" >