我使用重量輕的jQuery與AngularJS(這是從源說,我發現的溶液)走來添加屬性到一個刪除按鈕,如下所示:在AngularJS有條件呼叫功能
if (item.CustomerGuid == item.OwnerCustomerGuid) {
$scope.isDeleteDisabled = false;
$('#deleteFreight').attr("ng-click", "FreightGroup_delete(" + item.ListGuid + ", " + item.CustomerGuid + ")");
} else {
$scope.isDeleteDisabled = true;
}
當我檢查變化得到反映,但是當我嘗試點擊按鈕時,所需的功能沒有被調用。
需要幫助。
.cshtml(前):
<button class="btn btn-danger" ng-disabled="isDeleteDisabled"
id="deleteFreight">Delete Freight Group </button>
(後):
<button class="btn btn-danger active" ng-disabled="isDeleteDisabled"
ng-click="FreightGroup_delete(7338bb3a-9e6b-49d7-be08-7b60ff47ba61,
ce3adfcc-d8a1-4a6e-a2b7-d15dc1980384)" id="deleteFreight">
Delete Freight Group </button>
感謝您的建議,它很簡單。 – RandomUser 2014-09-03 10:27:18