在 Angular 2 中使用 Angular 1 库? [英] Using Angular 1 libraries in Angular 2?
问题描述
我可以使用 Angular 库,例如 Angular 2 应用程序中的 angular-cookies 吗?似乎这是不可能的,但我想知道这是因为我计划将项目升级到 Angular2
Can I use Angular libraries, for example angular-cookies in Angular 2 app? Seems that this is not possible, but I want to know this cause I'm planning to upgrade project to Angular2
推荐答案
一般来说,没有.如果您有兴趣通过运行 Angular 1 来遵循迁移指南2 同时,您也许可以让 Angular 1 库正常运行,但这可能不值得您费心.
In general, no. If you're interested in following the migration guide by running Angular 1 and 2 simultaneously, you may be able to get an Angular 1 library functioning, but it's likely not worth your trouble.
我鼓励您不要害怕为自己重写公共库.您会惊讶于它是如此简单 - 在许多情况下,您会花更多时间试图找出库的文档,并且对代码有了深入的了解.
I'd encourage you not to be scared of rewriting common libraries for yourself. You'll be surprised by how easy it is - in many instances you'd spend more time trying to figure out a library's documentation, and you gain an intimate understanding of the code.
这篇关于在 Angular 2 中使用 Angular 1 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!