1

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?

2
  • did you try any? please, post what you did so far Commented May 25, 2013 at 21:20
  • likely easier to use a directive.... templateURL is part of directive object Commented May 26, 2013 at 3:30

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.