I am developing a web-application using Angular Js framework, with HTML5 and with the help of jQuery, when it is needed. The question is:
I have some fields whose values depend on the result of an AJAX call. This request returns a JSON and the fields of this JSON become the values of many tags.
For example, in the HTML code, I have:
<span>Data Nascita: <b><span id="patientBirthdate">{{patient.birthDate}}</span></b></span>
And in my controller, I have this request:
$.ajax({
type: "GET",
url: url,
async: true,
crossDomain: true,
success:function(result){
$scope.person = result;
},
error: function(xhr,status,error){
console.log ("error in receiving person's data");
}
});
This data-binding works properly.
The question is: how can I intercept the end of the operation of data-binding (the end of the filling of the {{patient.birthDate}} field) to somehow call on this field another javascript method?
My goal is to "shorten" the value of this field, after the filling made by Angular, with a jQuery plugin, with a call of this type:
$("#patientBirthdate").shorten({showChars: 15, moreText: ' >>', lessText: ' <<'});
Thanks in advance.