Javascript 在脚本中使用角度模型数据
我需要一些控制器模型数据共享方面的帮助 在HTML中,我可以通过Javascript 在脚本中使用角度模型数据,javascript,html,angularjs,Javascript,Html,Angularjs,我需要一些控制器模型数据共享方面的帮助 在HTML中,我可以通过{{block.title}}访问数据,但在HTML中,我还可以使用一些javascript打开外部文件: <div class="container"> <accordion close-others="oneAtATime"> <accordion-group ng-repeat="block in report.blocks" is-open="block.$$isOpen
{{block.title}}
访问数据,但在HTML中,我还可以使用一些javascript打开外部文件:
<div class="container">
<accordion close-others="oneAtATime">
<accordion-group ng-repeat="block in report.blocks" is-open="block.$$isOpen">
<accordion-heading>{{block.tags}}
</accordion-heading>
<script>
$(function() {
$("#includedContent").load("res/filename.html");
});
</script>
<div id="includedContent"></div>
</accordion-group>
</accordion>
</div>
{{block.tags}
$(函数(){
$(“#includedContent”).load(“res/filename.html”);
});
我想要的是使用block.title
(在ng repeat
的内部)的当前值来代替filename.html
,例如:
load(“res/{{block.title}}.html”)
我怎样才能做到这一点
谢谢。您可以相对轻松地在angular中实现这一点,无需jQuery
<div id="includedContent" ng-include="getPartial(block.title)"></div>
显示您的html。。这很简单。。您可以使用ng模型完成此操作。@Ved在我的问题中更新
$scope.getPartial = function(file) {
return "res/"+file;
};