angularjs - 为什么模板没有在测试中编译?
问题描述
我为我的控制器写了一个规范。Angular 模块 ngCountdownRibbon 具有向文档正文添加带有计数器的功能区的逻辑。在 getRibbonDate 函数中,我想访问此计算值并在测试中检查它们(html 元素的内部文本)。但不知何故,当我尝试获取它时它没有被编译。我怎样才能让这个规范工作?
期望的行为
附加在文档正文中的编译代码应为:
<a ng-href="http://amzn.com/w/ZWFNUL8AGNLP" class="ribbon-container ng-scope"
target="_blank" href="http://amzn.com/w/ZWFNUL8AGNLP">
<span class="ribbon ribbon_left" ng-class="ngCountdownRibbon.ribbonClass">
<span>
<ng-pluralize
count="ngCountdownRibbon.ribbonDays"
when="{'0': 'Event has come', 'one': '1 day left', 'other': '{} days left'}"
<=""
ng-pluralize="">1 day left
</ng-pluralize>
</span>
</span>
</a>
我现在在编译代码中得到什么
LOG:
<a ng-href="{{ngCountdownRibbon.ribbonLink}}" class="ribbon-container ng-scope"
target="_blank">
<span class="ribbon" ng-class="ngCountdownRibbon.ribbonClass">
<span>
<ng-pluralize
count="ngCountdownRibbon.ribbonDays"
when="{'0': 'Event has come', 'one': '1 day left', 'other': '{} days left'}"
<="" ng-pluralize="">
</ng-pluralize>
</span>
</span>
</a>
重现的最短方法是 fork repo并从分支 init-tests 运行“npm test”命令
解决方案
推荐阅读
- javascript - 如何在javascript中的localstorage中保存多个元素的颜色
- python - 爬取结果链接的页面打不开
- node.js - 我如何将 eth 值发送到在 ethers.js 中支付的特定智能合约功能?
- css - 尝试在播放视频的同时突出显示文本
- kotlin - Intellij jvm 不显示我的控制台输出
- c# - 在 Blazor 组件中获取当前用户
- python - Jinja2 电子邮件模板
- sonos - 为什么 SONOS 的自定义 SD 系统不再工作?
- hibernate - 将枚举作为方法参数传递会导致 Hibernate 异常
- r - 带有 dplyr 的 for 循环