1

我正在通过 AJAX 从 angularjs 控制器中加载 HTML 模板,并希望使用它来呈现我也通过 AJAX 加载的 JSON 对象的集合。如何让 angularjs 将我的模板字符串呈现为集合并将其插入 DOM?

4

1 回答 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.

于 2013-05-25T23:32:39.170 回答