Monday, February 6, 2017

What are Global Value Providers in lightning components?

What are Global Value Providers in lightning components?


Global value providers are global values and methods that a component can use in expressions.




First we will see how to use $Browser global value provider to check the browser I am running my lightning component.




Output is:

Similarly, you can check browser information in a client-side controller using $A.get().

({
    checkBrowser: function(component) {
        var device = $A.get("$Browser.formFactor");
        alert("You are using a " + device);
    }
})


Similarly, you can check locale information in a client-side controller using $A.get().


({
    checkDevice: function(component) {
        var locale = $A.get("$Locale.language");
        alert("You are using " + locale);
    }
})




You can refer in salesforce documentation:

1 comments:

Post a Comment

 
| ,