TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

JQuery vs. AngularJS: A Comparison and Migration Walkthrough

28 点作者 daniellmb超过 10 年前

8 条评论

jasode超过 10 年前
JQuery vs AngularJS comparison is reasonable because many developers will know JQuery and wonder what that new AngularJS thing offers them. That&#x27;s why the following epic stackoverflow answer has 6000+ upvotes:<p><a href="http://stackoverflow.com/questions/14994391/thinking-in-angularjs-if-i-have-a-jquery-background" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;14994391&#x2F;thinking-in-angu...</a><p>Also, bloggers will often compare them as the following article does (HN discussed it previously):<p><a href="http://okmaya.com/2014/03/12/the-reason-angular-js-will-fail/" rel="nofollow">http:&#x2F;&#x2F;okmaya.com&#x2F;2014&#x2F;03&#x2F;12&#x2F;the-reason-angular-js-will-fail...</a><p>So yes, JQuery vs AngularJS is like comparing apples &amp; oranges but one way to reach the understanding of <i>why</i> it&#x27;s apples and oranges is to explicitly compare them!<p>While many line-item features of AngularJS and JQuery do not overlap, they <i>do</i> overlap in devs&#x27; mindshare to program a web page. Hence, the comparisons will continue.
daniellmb超过 10 年前
If you already understand both jQuery and AngularJS, it may seem a little silly to compare them. Like comparing a motor to a car. Yet, this article will help those that know about jQuery, and want to learn more about the strengths AngularJS has to offer. Specifically, the comparison shows what both of these tools are good at, and empowers you to know what one best fits the needs of your application.<p>There are a several factors that will help you decide whether or not to use AngularJS. In my opinion it&#x27;s not so much how complex the user interface is, although that is certainly relevant. The first thing to consider is where you want to put your application logic, server-side or client-side. The more things you want to push down to the client, the more likely AngularJS will better fit your needs. Are you creating a single page application where url-to-resource routing is done in JavaScript, or will that be handled server-side? Will you be merging data with templates on the server, on the client, or both? I suggest you look at the &quot;too long; didn&#x27;t read&quot; chart in the article, and see if you need the features AngularJS provides. How important is it to you that your client-side code is testable? While it is possible to unit test jQuery code, the way most developers write nested callbacks tightly coupled to event handlers, does not lend itself easily to isolated testing. Finally, you need to decide if your team wants to embrace the declarative style of application development advocated by AngularJS. Such as using the directive ng-click vs. $(elm).click(). This will most likely require a change in mindset, and should be carefully weighed.
评论 #8763221 未加载
debacle超过 10 年前
I don&#x27;t understand. The comparison breaks down in the very first example - where is the example of Angular&#x27;s excellent DOM abstraction and compatibility magic?<p>&quot;And then I refactored something that was bad to make it faster.&quot;<p>There&#x27;s also a typo in the jQuery example.<p>There&#x27;s no comparison. jQuery provides way more for actual DOM magic than Angular does.<p>&gt; As I have outlined in this article, AngularJS can do everything that jQuery does and much more...<p>But you didn&#x27;t. You didn&#x27;t even provide an Angular implementation of your very <i>first</i> example.
评论 #8764992 未加载
评论 #8764253 未加载
评论 #8763903 未加载
carsongross超过 10 年前
Java Socket Programming vs J2EE: A Comparison and Migration Walkthrough.
angersock超过 10 年前
One of the annoying sticking points with Angular for me has been that it really doesn&#x27;t play nicely with jQuery or jQuery-derived components (like a lot of the awesome stuff in the jQuery-UI package).<p>Like, sure, I get it, I get it, you&#x27;re a framework for doing all this high-brow enterprise single-page app stuff, you own the DOM, you have DI patterns for testability, yadda yadda yadda...why the hell is it so hard to use, say, flotr2 to draw charts with you?<p>Why does your documentation not show the (common!) example of wrapping working and existing jQuery (or AJAX, or whatever) libraries into directives&#x2F;services in The One True Angular Way?<p>Sure, polymer and web components and all that happy horseshit will make things better--years from now. Some of us are trying to deliver functionality <i>today</i>. It&#x27;s like the devs&#x2F;community don&#x27;t even acknowledge that this is a problem.
Raphmedia超过 10 年前
At first, I was confused. &quot;Oranges vs. Apples!&quot;. But then, I saw the file size. I understand the article as in if you use Angular in your app, you shouldn&#x27;t be also using jQuery. It is also a good way to introduce Angular to someone that has experience with jQuery. That being said, &quot;orange vs. apples&quot;.
_mtr超过 10 年前
&gt; 1 Framework Comparison<p>jQuery is a library, not a framework!
评论 #8764014 未加载
prakash-news超过 10 年前
got my doubt on both of this though i m not a javascript or jquery fan, always try to make my way to the middle with css. Thanks for this article.