I am using AngularJs for the first time and I would like to know why this is not possible, I notice that during the debug, there are several Parse errors inside the min.js of the angular, I believe that is why the type I am passing for his controller it's Guid type. Any solution?
<script>
angular.module("tecboxAngular").controller("SetorController",
function ($scope) {
$scope.SetarIdParaEdicao = function (itemId) {
alert(itemId);
$scope.setorId = itemId; // The function returns the product of p1 and p2
}
});
</script>
@using (Html.BeginForm())
{
<div class="table-responsive" ng-model="setorId" ng-controller="SetorController">
<table class="table table-hover" style="font-size: 11px; font-weight: 500;">
<thead>
<tr>
<th>NOME</th>
</tr>
</thead>
<tbody>
@{
int classAux = 0;
string classe;
foreach (var item in Model)
{
if (classAux > 0)
{
classe = "warning";
classAux = 0;
}
else
{
classe = String.Empty;
classAux++;
}
<tr class="@classe" ng-click="SetarIdParaEdicao(@item.Id)">
<td>
@Html.DisplayFor(x => item.Nome)
</td>
</tr>
}
}
</tbody>
</table>
<a class="btn btn-primary" href="/Setor/Edit/{{setorId}}">Editar</a>
</div>
}
The tags that initialize the Angularjs are in another file, but everything is working because the alert inside the script works when I change the value that is passed by the controller.