Razor Viewを使用してasp.net mvc4で作業しています。私はそれで angularJs を使用しています。しかし、部分的なビューでは angularJs が機能していません。
ここに私のビューコードがあります:
@using (Html.BeginForm("Create", "Requisition", FormMethod.Post, new { id = "RequisitionForm", ng_app = "" }))
{
@Html.ValidationSummary(true)
<div class="divSection">
<div class="divBox divSectionLeftLeft">
<label>Product</label>
</div>
<div class="divBox divSectionLeftRight">
<input type="text" id="ProductName" name="ProductName" ng-model="newItem.ProductName" />
</div>
<div class="divBox divSectionRightLeft">
<label>Quantity</label>
</div>
<div class="divBox divSectionRightRight">
<input type="text" id="Quantity" name="Quantity" ng-model="newItem.Quantity" />
</div>
</div>
<div class="divClear">
</div>
<div class="ContainerRowButton">
<button type="button" class="btn btn-primary btn-mini" ng-click="items.push(newItem); newItem={}">Add Req-Detail</button>
</div>
<div style="width: 800px; height: 160px; overflow-y: scroll">
<table class="table table-striped table-bordered" id="RequisitionDetailsTbl" ng-init="items=[]">
<thead>
<tr>
<th>Product
</th>
<th>Quantity
</th>
<th>Action</th>
</tr>
</thead>
<tr ng-hide="items.length">
<td colspan="3">No Requisition Added Yet. . .</td>
</tr>
<tbody ng-repeat="item in items">
<tr>
<td>{{item.ProductName}}
</td>
<td>{{item.Quantity | number:2}}
</td>
<td>
<button type="button" id="delReqDetail" ng-click="items.splice($index, 1);" class="btn btn-primary btn-mini">Delete</button>
</tr>
</tbody>
</table>
</div>
}
私の _Layout は次のようなものです:
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/jquery, ~/bundles/jqueryui, ~/bundles/others")
ここで、「~/bundles/others」には angular.js が含まれています。
firebug コンソールでエラーが発生しません。私は何を間違っていますか?
もう1つ、ポップアップウィンドウにパーシャルビューを表示しています。ポップアップウィンドウで使用しない場合、コードは正常に機能します。