I've been looking for a simple way of making all input fields read-only when a record is flagged as read-only.
Obviously I can add ng-readonly to every field on the form, but thought that $watch would be a more concise solutions, so I added the following:
$scope.$watch('quote.Metadata.status', function () {
$('.disableable').find(':input:not(:disabled)').prop('disabled', ($scope.quote && $scope.quote.Metadata.Status == 2));
});
The problem is that this does disable the fields in an ng-repeat template because the $watch is applied before the repeat has rendered the controls.
Is there a way to trigger changes after the templates have been applied, or is there an alternative (better) way to approach the problem?
Cheers,
Jason