【发布时间】:2014-04-30 13:37:24
【问题描述】:
我正在尝试将 AngularJS $scope 用作 HTML 属性而不是可视文本。
main.js
var myApp = angular.module('myApp');
myApp.controller("buttonCtrl", ['$scope', function($scope){
$scope.johnny = [
{quote: 'Anything for My Princess', controller: 'Princess'}
];
}]);
page1.html
<button ng-repeat="button in johnny"
ng-class="dynamic"
class="topcoat-button"
ng-controller="{{button.controller}}" <---- this is what does not work
ng-click="play()">
{{button.quote}}
</button>
如何解决这个问题,以便将这些变量添加为属性值。
谢谢
【问题讨论】:
标签: javascript html angularjs scope