angular.js を使用して、ビューからタイプ スクリプトで関数を呼び出す必要があります。私が使用するテクノロジーは、angular.js typescript と ASP.Net MVC3 です。
これは UI のリンクです。
<div id="left_aside" ng-controller="MyGivingPortfolioController">
<div class="charity_portfolio_tile" ng-repeat="Tile in VM.Tiles.TileContainerEntity" >
<a href="#" ng-click="Delete(Tile.Id)" class="delete_button">delete</a>
</div>
このリンクをクリックしても、メソッドは呼び出されません。
Delete = function (Id:number) {
alert("Called " + Id.toString());
}
次に、この関数を以下のように変更しました。
Delete(charityID: number) {
var id = charityID;
alert(id.toString());
}
コードを変更しましたが、機能しませんでした。実は、この理由はわかりません。
class MyController implements IMyController {
Tiles: TileContainerEntities;
constructor($scope, $http: ng.IHttpService) {
$scope.VM = this;
$http.get("/API/PrivateAPI/Test/1").success((responce) =>{this.BusinessReponseList = responce; });
}
Delete = function (Id:number) {
alert("Called " + Id);
}
//Delete(charityID: number) {
// var id = charityID;
// alert(id.toString());
//}
}
その方法を知っている人はいますか?