var myApp = angular.module('LoginApp',[]);
myApp.controller('dynamic', ['$scope', function($scope) {
$scope.a_1= "Admin";
$scope.auction_no = 1;
$scope.item = [{ A:"a" , B:1 }];
}]);
我必须在{{x}}中以HTML格式提供模型名称,x应该是{{item.A}} _ {{auction_no}}。最后它应该给出输出Admin
答案 0 :(得分:1)
您可以使用括号访问器$scope[$scope.item[0].A + "_" + $scope.auction_no]
答案 1 :(得分:0)
如果您能够将第一个变量作为对象:
$scope.auctions = {
a_1: 'Admin'
};
$scope.auction_no = 1;
$scope.item = [{ A:"a" , B:1 }];
var x = $scope.auctions[$scope.item[0]['A'] + '_' + $scope.auction_no];
变量x
此时应保留值Admin
。