Как понять, что вьюха изменилась? какое событие за это отвечает?
Например, есть вьюха
<table class="display table table-bordered">
<thead>
<tr>
<th>Table Name</th>
<th>Field</th>
<th>Condition</th>
<th>Definition</th>
</tr>
</thead>
<tbody ng-repeat="(tableName, fcd) in reports.FCD">
<tr ng-repeat="(name, fields) in fcd">
<td>{{ tableName }}</td>
<td>{{fields.alias}}</td>
<td><span ng-repeat="condition in fields.conditions">
<span>{{condition.operand}} </span><span>{{condition.value}} </span><span>{{condition.type}} </span>
</span></td>
<td>
<span ng-show="fields.definitions.paymentMethod != null">Payment Methods: </span><span ng-repeat="payment in fields.definitions.paymentMethod">{{payment}} or </span>
<span ng-show="fields.definitions.status != null">Status: </span><span
ng-repeat="status in fields.definitions.status">{{status}} or </span>
</td>
</tr>
</tbody>
</table>
И есть код, который её заполняет:
var app = angular.module('myApp', []);
var parentTr;
app.controller('customersCtrl', function ($scope, $http) {
$(".report-generator").on("click", ".dynamicTableReportsGenerator tbody tr td", function (e) {
parentTr = $(this).closest('tr');
if (!$(this).is('td:first')) {
e.preventDefault();
$http({
url: "/report-generator/getReportById",
method: "post",
data: $.param({"id": parentTr.find('input[type="checkbox"]').val()}),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function (response) {
$scope.reports = response;
$scope.$apply('myApp', function() {
$(".popup-wrapper").remove();
$("<tr class='popup-wrapper'><td style='box-shadow: inset 1px 0px 8px 1px #ccc;'></td></tr>").insertAfter(parentTr);
$(".popup-wrapper td").append($("#requestModal").html()); //Я пробовал с apply, но не вышло.
}, true);
});
}
});
});
Нужно проделать необходимые пертурбации с вьюхой, после того, как данные в неё подставятся. п.с. Я с ангуларом фигарю второй час) Но касательно этого вопроса ничего не смог нарыть.
Источник: Stack Overflow на русском