I'm loading an HTML template via AJAX from within an angularjs controller and would like to use it to render a collection of JSON objects I'm also loading via AJAX. How can I get angularjs to render my template string as a collection and insert it into the DOM?
1 Answer
I believe you're looking for ngBindTemplate: http://docs.angularjs.org/api/ng.directive:ngBindTemplate
Pass the template text retrieved from the first AJAX call in as the value for ngBindTemplate, and then make sure the JSON from the second call is put into the right place in the controller $scope to resolve the references in the template.
templateURLis part of directive object