本文介绍了NG-包括似乎无能为力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/ng-template" id="/newTrack.html">
  <h1>New Track </h1>
  <p>Hello there</p>
</script>
<div id="overlay" closemodal></div>
<div id="modal"><a id="closeModal" closemodal></a>
    <div id="modalContent" ng-include src="/newTrack.html"></div>
</div>

我希望以下结果:

I would expect the following result:

<div id="overlay" closemodal></div>
<div id="modal"><a id="closeModal" closemodal></a>
    <div id="modalContent" ng-include src="/newTrack.html">
       <h1>New Track </h1>
       <p>Hello there</p>
    </div>
</div>

但好像没有什么改变。真的,我想从一个自定义指令内呈现模板,跟踪下来一段时间后,它似乎我不能让 NG-包括,即使在其工作最简单的形式。缺少什么我在这里?

But nothing seems to happen. Really I am trying to render the template from inside a custom directive, after tracking it down for a while, it appears I can't get ng-include to working even in its most simple form. What am I missing here?

推荐答案

在小提琴选项,添加&LT;机身NG-应用&GT;

SRC:如果源是一个字符串常量,确保你把它包在引号,例如, SRC ='myPartialTemplate.html'。 -

所以 NG-包括SRC =/ newTrack.html'

这篇关于NG-包括似乎无能为力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 04:57