【问题标题】:Does UI Bootstrap template-url support common angular expressionUI Bootstrap template-url 是否支持常用的角度表达式
【发布时间】:2016-04-18 08:07:49
【问题描述】:

我有一个这样的覆盖模板的手风琴:

<uib-accordion-group template-url="/somefolder/accordion-group.html">

但我真的想为此使用范围变量,例如像这样:

<uib-accordion-group template-url="{{::urls.templateUrls.customAccordion}}">

但这似乎不起作用。

有没有办法在 template-url 中使用角度表达式或不支持?

【问题讨论】:

  • 一个类似的问题是这个:stackoverflow.com/questions/31586315/…。然而它并不能解决你的问题,但答案是指向原因(transclude:true for accortion)。
  • 听起来像是向开发人员请求的一个非常合理的功能。

标签: angularjs twitter-bootstrap angular-ui-bootstrap


【解决方案1】:

读取 template-url 属性的代码在指令的 templateUrl 函数中,如下所示here 在 $compile 阶段之前正在评估 template-url 属性,因此您尝试使用的插值尚未发生.虽然模板-url 评估可以移动到链接阶段,但 $compile 阶段必须针对新模板再次运行,这不是一个非常有效的方法

【讨论】:

  • 很遗憾,它存在技术上的复杂性,因为如果我使用我的模板 url,而不是使用一个常量,如果需要,我将不得不将路径复制/粘贴到许多地方.
猜你喜欢
  • 2011-06-23
  • 1970-01-01
  • 2017-11-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-03
  • 1970-01-01
相关资源
最近更新 更多