In PHP terminology that's called variable variables (IIRC). In Javascript 
it's not directly possible just like that, but there's some ways you could 
emulate it. One would be using objects and a key variable:

    var key = 'Car';
    var obj = {};
    obj.car = 'Mercedes';
    console.log(obj[key]); // mercedes

The real question you should ask though is: What are you trying to achieve? 
What's your use case? Variable variables in PHP are (IIRC) not very common 
or often used, there's not much use cases for them.

On Sunday, July 13, 2014 11:42:09 AM UTC+2, CoderBoy wrote:
>
> In PHP you can do something like this
>
> $x="Car";
> $$x="Mercedes";
> echo $Car;
>
> O/P : Mercedes.
>
> AFAIK I figured this thing is called reflection. So in GWT you can do 
> these kind of stuff somewhat differently. 
>
> I am wondering can we do the same in AngularJS either directly on 
> indirectly using some modules?
> Is it impossible what I am talking about?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to