在angular 6项目中使用jquery库是否很好? [英] Is it good to use a jquery library inside an angular 6 Project?

查看:131
本文介绍了在angular 6项目中使用jquery库是否很好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个angular 6项目,该项目先前是使用jquery开发的,现在我被卡住了,好像在Angular 6中使用jquery还是好,否则我应该删除所有jquery代码并将其替换为Angular吗?

I am creating an angular 6 Project which was earlier developed using jquery and now I am stucked as if it is good to use jquery inside Angular 6 or I should remove all the jquery codes and replace it with Angular ?

推荐答案

不,这不是一个好主意.您正在Angular应用程序中使用jQuery编码实践,这将使您头疼-一次是因为这些实践违背Angular精神,而且还因为您没有获得Angular的好处.

No, it is not a good idea. You are using jQuery coding practices in an Angular app and this will cause you headaches - for once because those practices go against the Angular spirit, and also because you don't reap the benefits of Angular.

您可以使用jQuery进行所有操作,例如使用DOM更改角度,监听事件组件事件或Windows事件,创建动态html elemnt,而angular会跟踪所有这些更改,并且您的应用程序没有任何副作用例如选择要素值变化和角度没有这种变化.

You can do everything you do with jquery with angular like DOM changes , listen to event component event or windows event , create dynamic html elemnt and angular will track all these kind of change and your app doesn't have any side effect for example select elment value changes and angular haven't got this kind of changes.

您可能会使用jquery,因为您已经有经验或想从jquery插件中受益,目前有大量的ui软件包都已实现为angular,并且一些公司开发了完整的ui组件,例如 primeng,kendo ui

you may thenk using jquery because you already have an experience or want to get the benefit of jquery plugins , currently there are alot of ui package realted to angular and some company develop a complete ui component like primeng,kendo ui

angular是一种如何构建Web应用程序的结构,因此,如果您想获得应用程序性能的好处,请根据构建Web应用程序的最佳实践以及最小的应用程序大小来做得很好的架构诸如组件和ui包之类的东西.

angular is a structure of how to build a web app so if you want to get the benefit of the app performance ,well done architecture base on the best practice of building web app, and app smallest size you have to stick to angular things like components and ui package.

这篇关于在angular 6项目中使用jquery库是否很好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆