HOW TO USE VALUE PROVIDERS IN SALESFORCE LIGHTNING ?
VALUE PROVIDERS
In this episode, we have something different to discuss i.e. salesforce lightning value providers.
Let's get started, So value providers are a way to access data.
Let's get started, So value providers are a way to access data.
Value providers encapsulate related value together, similar to how an object encapsulates properties and methods.
The value providers for a component are v(view) and c(controller).
The value providers for a component are v(view) and c(controller).
A component's view refers to its attribute set.
A component's controller enables you to wire up event handlers and action for the components. It's where you control your component's logic.
All components have value providers but aren't required to have a controller. Both value providers are created automatically when defined for a component.
In simple words, the salesforce value provider provides information about your browser, location, your device information etc.
Let's understand global value providers.
Global value providers are value and methods that a component can use in the lightning expression.
Global value providers are value and methods that a component can use in the lightning expression.
globalId: It returns the global ID for a component has a unique globalId, which is generated runtime-unique ID of the component instance.
$Browser: It returns information about the hardware and operating system of the browser accessing the application.
$Label: It enables you to access labels stored outside your code.
$Locale: It returns information about the current user's preferred locale.
Now we are more interested to discuss $Browser and $Locale.
isAndroid: It indicates whether the browser is running on an Android device (true) or not (false).
isIOS: It is not available in all implementations. It indicates whether the browser is running on an iOS device (true) or not (false).
isIPhone: It indicates whether the browser is running on the iPhone (true) or not (false).
isWindowsPhone: It indicates whether the browser is running on a windows phone (true) or not (false).
FORM FACTOR ATTRIBUTE :
It returns a Form Factor enum value based on the type of hardware the browser is running on
It returns a Form Factor enum value based on the type of hardware the browser is running on
DESKTOP for a desktop client
PHONE for the phone including a mobile phone with a browser and a smartphone
TABLET for a tablet client (for which isTablet returns True)
=================================================
<aura:component>
Browser running on Tablet: {!$Browser.isTablet}
<br></br>
Is it running on IPhone: {!$Browser.isIPhone}
<br></br>
Is it running on Android: {!$Browser.isAndroid}
<br></br>
<br></br>
Is it running on IPhone: {!$Browser.isIPhone}
<br></br>
Is it running on Android: {!$Browser.isAndroid}
<br></br>
I am Running on : {!$Browser.FormFactor}
</aura:component>
=================================================
Output :
Output :
=================================================
Browser running on Tablet: false
Browser running on Tablet: false
Is it running on IPhone: false
Is it running on Android: false
Is it running on Android: false
I am Running on DESKTOP
=================================================
Now we have attributes of $Locale global value providers.
$Locale:
The $Locale global value provider returns information about the current user's preferred locale.
Country: The ISO 3166 representation of the country code based on the language locale.
Currency: The currency symbol.
Timezone: The time zone ID.
NumberFormat: Gives number formatting.
Country: The ISO 3166 representation of the country code based on the language locale.
Currency: The currency symbol.
Timezone: The time zone ID.
NumberFormat: Gives number formatting.
=================================================
<aura:component>
<aura:component>
Language : {!$Locale.language}
<br></br>
TimeZone : {!$Locale.timezone}
<br></br>
TimeZone : {!$Locale.timezone}
<br></br>
Number Format : {!$Locale.NumberFormat}
<br></br>
Currency : {!$Locale.Currency}
<br></br>
</aura:component>
=================================================
Output:
=================================================
Language : en
TimeZone : America / Los-Angeles
Number Format : #, ##0, ###
Currency : $
=================================================
Coool !! In this way, you can use value providers in salesforce lightning component.
In the new episode, we will discuss standard salesforce component and force.com component.
Currency : {!$Locale.Currency}
<br></br>
</aura:component>
=================================================
Output:
=================================================
Language : en
TimeZone : America / Los-Angeles
Number Format : #, ##0, ###
Currency : $
=================================================
In the new episode, we will discuss standard salesforce component and force.com component.
WOHOOO !! YOU HAVE JUST COMPLETED LIGHTNING VALUE PROVIDERS EPISODE
If you like this salesforcekid learning platform please let me know in the Comment section...Also, Share with your salesforce folks wish you
Happy learning ☁️⚡️ (Learn. Help. Share.)
<< PREVIOUS NEXT >>
If you like this salesforcekid learning platform please let me know in the Comment section...Also, Share with your salesforce folks wish you
Happy learning ☁️⚡️ (Learn. Help. Share.)
<< PREVIOUS NEXT >>
HOW TO USE VALUE PROVIDERS IN SALESFORCE LIGHTNING ?
Reviewed by
on
Rating:
Can you please make more episodes on aura lightning components?
ReplyDeleteHey There !!
ReplyDeletePlease visit our website Blog section for more Episodes...
Happy Learning 😊
Ajinkya can you please share your website url?
ReplyDeleteSure !!
ReplyDeletePlease find the seperate blog section for lightning components.
LINK :
https://www.salesforcekid.com/p/blog-page_25.html
HAPPY LEARNING 😊
Best Regards,
AJINKYA DHAS
Ajinkya I am learning from your blog section but i want to say that can you please make additional tutorial how to insert, update and delete records from salesforce using aura lightning component?
ReplyDeleteSure !! I will definitely create this seperate section. thanks for suggestion 😊
ReplyDeleteHAPPY LEARNING 😊
Best Regards,
AJINKYA DHAS
Hey There,
ReplyDeleteAs per your request I have added the blog on how to insert records in salesforce lightning component.
Please find the link attached below :
https://www.salesforcekid.com/2020/03/create-record-in-salesforce-lightning-component.html
I hope you like it 😊
HAPPY LEARNING
[SalesforceKid]
Thanks alooot Ajinkya <3
ReplyDeletewaiting for your more best tutorials (Y) <3
You are most welcome ! 😊
ReplyDeleteBest Regards,
AJINKYA DHAS