Looking to convert my small jquery app into AngularJs, seeking advice on the feasibility of doing so. Currently, the app makes ajax calls to retrieve Json data which is then parsed and displayed in the dom.
The challenge lies in the variety of json properties - simple strings, arrays, or nested objects. When parsing the Json, I format it accordingly - creating tables for arrays, calculating string lengths, and outputting the results to the dom.
While achievable with jquery, the process is somewhat verbose. Curious to know if a similar functionality can be replicated using AngularJs.
$.each(data.ALLIMG, function(i, image) {
if(image.alt){
$("#imagesDetail").append("<li>ALT:" + image.alt + " SRC: ");
$("#imagesDetail").append(image.src + "</li>");
totalAltImg++;
}
});
$("#text").append("<p>" + data.TEXT + "</p>");
$("#text").append("<p><b>Length: </b>" + data.TEXT.LENGTH + " character(s)</p>");
In angular syntax, it seems like I should use something like {{text}}
. But how do I handle arrays to display as tables or lists?