繁体   English   中英

为什么非定制Angular管道导致我的构建无法通过,但所有测试都通过了,而棉绒通过了?

[英]Why is a non-custom Angular pipe causing my build to not pass, yet all tests pass, and linting passes?

我现在正在开发一个Angular 4项目,并且在其中使用NumberPipe ,我什至不需要导入它就可以正常工作,因为据我所知它来自CommonModule

我像这样在模板中使用管道...假装results是组件中的数字。

<p>{{ results | number : fractionSize }} Results</p>

问题是,它导致我的Jenkins构建失败...它说Property 'fractionSize' does not exist on type 'AuctionsComponent'

我的问题是,由于我不必导入它就可以在项目中使用它,为什么它对我的测试不可用,以及是否需要在模块中声明它,在哪里,为什么?

这是詹金斯寄来的消息的副本...

13:54:11 Date: 2017-11-16T20:54:11.047Z
13:54:11 Hash: 17c7bbfe51457a0c0c2a
13:54:11 Time: 34993ms
13:54:11 chunk {0} styles.d1347092f22621d601cc.bundle.css (styles) 402 kB {3} [initial] [rendered]
13:54:11 chunk {1} polyfills.3bc34265385d52184eab.bundle.js (polyfills) 86 bytes {3} [initial] [rendered]
13:54:11 chunk {2} main.e402deade8b026b7d50e.bundle.js (main) 84 bytes {3} [initial] [rendered]
13:54:11 chunk {3} inline.074cdf405b107f2b24b9.bundle.js (inline) 1.45 kB [entry] [rendered]
13:54:11 
13:54:11 ERROR in ng:///var/lib/****/workspace/Build/build_gitlab_angular_app/src/app/components/pages/auctions/auctions.component.html (40,40): 
Property 'fractionSize' does not exist on type 'AuctionsComponent'.

了解这方面的任何帮助都会让我感到高兴! :)

数字管道应看起来像这样:

{{ results | number : '1.0-2' }}

其中1是最小整数位数; 0是最小十进制数字; 和2是最大十进制数字。

https://angular.io/api/common/DecimalPipe

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM