No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Client-Side Runtime Binding of Components
Use a client-side provider if you don’t need to access the server when creating a component.
Creating a Provider
A client-side provider is part of the component bundle. To reuse a provider from another component, you can use the provider system attribute in aura:component instead. For example, this component uses the auto-wired provider in the sampleComponent bundle.
1swfobject.registerObject("clippy.codeblock-0", "9");<aura:component
2 provider="js://auradocs.sampleComponent">
3 ...
4</aura:component>A client-side provider is a simple JavaScript object that defines the provide function. For example, this provider returns a string that defines the topic to display.
1swfobject.registerObject("clippy.codeblock-1", "9");({
2 provide : function (cmp) {
3 var topic = cmp.get('v.topic');
4 return 'auradocs' + topic + 'Topic';
5 }
6})Instead of a string, a provider can return a JSON object to provide both the concrete component and set some additional attributes. For example:
1swfobject.registerObject("clippy.codeblock-2", "9");({
2 provide : function (cmp) {
3 var topic = cmp.get('v.topic');
4 return {
5 componentDef: 'auradocs' + topic + 'Topic',
6 attributes: {
7 "type": "task"
8 }
9 }
10 }
11})You can omit the componentDef entry if the component is already concrete and you only want to provide attributes.