angularjs - how to access variable attribute name by another variable -


i looking hours, , couldn't find solution this.

i have following:

var app = angular.module('myapp', []); app.controller('customersctrl', function($scope, $http) {     $scope.varname = "x";     $scope.x = "hello world!"; } 

now, need access x, name in variable, like:

<td>{{ {{ varname }} }}</td> 

which doesn't work. other variations didn't work.

any idea if possible?

use map in controller store such objects as,

$scope.dynamap.x = "hello world" 

in html code, do

<td>{{ dynamap[varname] }}</td> 

here, assume varname x


Comments