1
event.id在html文本中正確呈現/編譯,但函數沒有正確接收它。即使它在源代碼中正確顯示,這裏發生了什麼?angularjs ng-click函數參數不適用於ng-repeat
<span ng-repeat="event in [{"id":"dxczhlyvmblc","name":"4 on 4 - Pickup","venuename":"Box Hill Aqualink","numspotsleft":"<strong>Spots now open<\/strong>","day":"28","dayname":"Wednesday"}]">
<button ng-click="toggleModal('<% event.id %>')">More detail = <% event.id %></button>
</span>
shopApp.controller('MainController', function($scope, $http, $q){
$scope.toggleModal = function(eventId){
console.log(eventId+" toggle");
};})
注意我使用<%在{因爲模板引擎{代替。
非常好,一直在尋找這個! – Michel