找不到可以与角流星完美搭配的日期选择器 [英] Can't find a datepicker that plays nicely with angular-meteor
问题描述
我尝试向我的项目添加一堆不同的datepicker库:
I've tried to add a bunch of different datepicker libraries to my project:
- 流星1.7
- 角度6
- 引导程序4
对于大多数用于Angular的软件包,在启动时导入期间会出现错误.该错误通常看起来相似.这是ng-bootstrap的确切错误:
For most of the packages that are intended for Angular I get an error during import on startup. The error normally looks similar. Here is the exact error from ng-bootstrap:
Uncaught Error: Can't resolve all parameters for NgbAlert: (?).
在发生该错误的情况下,我没有在任何地方添加NgbAlert
,这完全是因为添加了NgbModule.forRoot()
,所以不要让警报使您感到困惑,该问题肯定与导入模块有关.
In the case of that error I have not included an NgbAlert
anywhere, it's solely from adding NgbModule.forRoot()
so don't let the alert confuse you, the issue definitely has something to do with importing the module.
我尝试过:
- ng-pick-datetime
- Ngx-Bootstrap
- ng-bootstrap
- 和其他一些人
任何建议将不胜感激!
推荐答案
半解决方案
在流星环境变量中设置AOT = 1.
Set AOT=1 in meteor environment variables.
讨论
我可以通过以下方式使ng-bootstrap正常工作:对库进行符号链接(以确保已被编译),然后在启用AOT的情况下构建Meteor.
I was able to get ng-bootstrap working by sym-linking the library (to ensure that it is transpiled) and then building Meteor with AOT enabled.
我将原始故障范围缩小到Angular JIT编译器代码中的某个区域.关于Angular的正常编译流程,我真的不了解Angular-Meteor的angular-compiler代码是如何工作的,因此我无法真正找到问题的根源.如果有人可以提供较低级别的解释,我将不胜感激!
I narrowed down the original failure to an area in the Angular JIT compiler code. I really don't know a ton about how Angular-Meteor's angular-compiler code works, in relation to Angular's normal compile flow, so I can't really get to the root of the problem. If anyone can provide a lower level explanation, I'd really appreciate it!
更新
在另一个不同但类似的问题中, ironmanu 在
In a different, but similar question a better semi-solution was provided by ironmanu on this question. It's still not a perfect solution but it's a usable bandaid.
解决方案是将require('reflect-metadata');
添加到app.module.ts
中导入的模块的顶部.这解决了JIT期间的问题.我不确定为什么Angular编译器不会固有地解决此问题,但这可以解决问题!
The solution is to add require('reflect-metadata');
to the top of the module imports in app.module.ts
. This solves the issue during JIT. I'm not sure why the Angular compiler doesn't inherently take care of this issue, but this does the trick!
这篇关于找不到可以与角流星完美搭配的日期选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!