+ Start a Discussion
Ken KoellnerKen Koellner 

What are "v" and "c" in the Expenses example in the Lightning Component Developers Guide?

I'm working through Expenses example in the Dev Guide and see "v." and "c." in several locations but they aren't things that are declare anywhere.

Are these well-known objects that have to be referenced via "v" and "c"?  Like mayb "v" is view and "c" is controller" or something like that?

I'm curious if the code could be altered and the "v." and "c." terms could be changed if they are declared somewhere or if I'm coding in this style, must I use objects referred to by the specific named "v" and "c".
jp1234jp1234
As you have rightly guessed, v refers to view and c refers to controller.  Lightning Component Developer's Guide (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/) does mention that somewhere.
Ken KoellnerKen Koellner
Thanks for the reply jp.

I feel a little better if they are constant than if they are declared variables.  I know a lot of examples use one character variables like "Opportunity o;" or "Exception e" but I happen to deplore it as it makes global renames when refactoring code a pain.  At least "Exception ex" and "Opportunity opp" make it easier to read.
 
jp1234jp1234
I agree.  That's not a great naming of those "constants."  I wonder if it is a legacy from some framework that Lightning Component is based upon. 
Fabien TaillonFabien Taillon
You can have a look to this perfect answer from Lightning Product Manager : https://developer.salesforce.com/forums?id=906F0000000AndMIAS
Saptarshi GhoshSaptarshi Ghosh
These are value providers, more details on the link.
https://developer.salesforce.com/docs/atlas.en-us.200.0.lightning.meta/lightning/expr_source.htm
 
Susannah PSusannah P
Yes v stands for value providers. A good explanation can be found on trailhead: https://trailhead.salesforce.com/trails/lex_dev/modules/lex_dev_lc_basics/units/lex_dev_lc_basics_attributes_expressions
Ajinkya DhasAjinkya Dhas
Hi Ken,

- When we use v.abc, we are actually calling value hold by attribute abc.
- When we use c.xyz, we are calling value return by the controller It can be server-side-controller (.JS controller )or client-side-controller (Apex Class)
Hence It is called as value providers because they are providing value.

You can also check the following link to learn salesforce lightning development from scratch
https://www.salesforcekid.com/p/blog-page_25.html


Ajinkya Dhas,
https://www.salesforcekid.com


Please select this answer as best answer if it helps Thank You.