You need to sign in to do that
Don't have an account?
Artur Kolasa 7
What is correct approach to use constants in lightning components?
Hi
I have problem in my project, because i have application components with a lot of components and i have to define some constance to use them across all components in application. What is the best approach for this? Currently I define a lot of attributes with default text value and I use them as constans but i think that isn't the best solution.
I have problem in my project, because i have application components with a lot of components and i have to define some constance to use them across all components in application. What is the best approach for this? Currently I define a lot of attributes with default text value and I use them as constans but i think that isn't the best solution.
What you can do is use a single attribute of type object and then you can have sub attributes for that object type.
You can use it like this
All Answers
What you can do is use a single attribute of type object and then you can have sub attributes for that object type.
You can use it like this
You can create a custom label and refer as {!$Label.c.LabelApiName} in component or $A.get("$Label.c.LabelApiName") in your controller or helper.
Mark this as an answer if it solves your problem.