Skip to main content
added link
Source Link

You can use Bracket Notation to have custom object key by ['text'+variable].

vm.showComponent = function(componentName)
{
   hideComponents();
   vm['show' + componentName]=true;
}

You can have custom object key by ['text'+variable].

vm.showComponent = function(componentName)
{
   hideComponents();
   vm['show' + componentName]=true;
}

You can use Bracket Notation to have custom object key by ['text'+variable].

vm.showComponent = function(componentName)
{
   hideComponents();
   vm['show' + componentName]=true;
}
improved answer
Source Link

You can have custom object key by ['text'+variable].

vm.showComponent = function(componentName)
{
   hideComponents();
   vm['show'+componentName]=truevm['show' + componentName]=true;
}
vm.showComponent = function(componentName)
{
   hideComponents();
   vm['show'+componentName]=true
}

You can have custom object key by ['text'+variable].

vm.showComponent = function(componentName)
{
   hideComponents();
   vm['show' + componentName]=true;
}
Source Link

vm.showComponent = function(componentName)
{
   hideComponents();
   vm['show'+componentName]=true
}