If AngularJS is more powerful than jQuery, why is it so powerful?
阿神2017-05-15 16:59:55
The above answer is obviously unreasonable. It may be because I have never used ng. The main reasons why ng is more powerful than jq are:
jquery modifies elements by manually operating the dom, and ng modifies the data and automatically synchronizes it to the dom
For example, there is a list to display:
<ul ng-repeat="i in list"><li>{{i}}</li></ul>
ng code: $scope.list = [1,2,3],
修改list $scope.list[2] = 4
The third li of dom’s ul will automatically become 4
And for jq, the code needs to be:
list[2] = 4
$('ul').html('')
$.each(list, function(i,v){ $('ul').append('....') })
To put it bluntly, if you modify the data during ng execution, the html will automatically change. If you modify the data with jq, you still need to modify the html yourself
Moreover, in ng, after the html (such as the value of the form input) changes, the data automatically changes, while jq still needs var data = $('input').val();
This is called two-way binding of data.
Of course ng is only suitable for single-page applications and is not conducive to SEO. This is another matter
怪我咯2017-05-15 16:59:55
These are two things with completely different concepts and are not comparable.
滿天的星座2017-05-15 16:59:55
First of all, the two are not very comparable. The focus of jquery is to provide a variety of element selections and various methods of selecting elements to help developers quickly develop pages. But in essence, it is not a program framework. Moreover, many selector angles can be implemented directly using native tools, while Angular is more about the development convenience brought by its automatic binding of data and pages, which is more suitable for scenarios where the page has relatively few interactions and focuses more on data presentation. Use below.
So if lz wants to compare, what we should actually compare is backbone and angular.
滿天的星座2017-05-15 16:59:55
Most of the code in a Markdown editor that I spent a long time writing actually only implemented a little bit of AngularJS; and I quickly wrote and implemented many functions of jQuery myself.
After reading the jQuery core code, I feel that jQuery provides a writing style, while AngularJS is truly powerful and difficult to implement by yourself. The missing corner of JS opens up a new way of thinking.
Of course, jQuery and AngularJS focus on different things and have their own applications in their respective fields.
Just in terms of the difficulty of implementing it yourself, AngularJS is greater than jQuery.
jQuery focuses on code, AngularJS focuses on architecture and functionality.
Reference: http://damoqiongqiu.iteye.com/blog/1926475 https://angularjs.org/
http://jquery.com/
phpcn_u15822017-05-15 16:59:55
Functionally speaking, these two things are not comparable at all.
If you look at the way the entire code is written, I feel that jquery is more elegantly written. But in fact, there is no absolute, after all, everyone is different.
ringa_lee2017-05-15 16:59:55
There is really no comparison. jQuery is just a class library for operating DOM, while AngularJS is an MVC (or MVVM) framework.
AngularJS realizes the complete separation of View and data. The two-way data binding function provided by AngularJS synchronizes View all the time as long as the data is modified, and there is basically no need to manually operate the DOM.
Of course, in addition to the two-way data binding function, AngularJS also provides routing, services, filters, templates, instructions, module management, dependency injection, unit testing and other functions.
I don’t know if you will have an intuitive understanding of the difference between the two after saying this.
PHP中文网2017-05-15 16:59:55
This question is like asking whether a hammer is stronger than a screwdriver. What is the strength?
With different concepts, no one can replace the other. It’s really impossible to say who is more powerful. You can choose which one to use based on your needs. They are all very useful tools.
Some people compare jqueryui and angularjs and think it’s silly
Angular is a framework model for overall development. No matter what kind of framework it is, it needs favorable tools to assist its implementation. At this time, jquery plays a huge role as a tool and is a very easy-to-use Swiss Army knife, haha, so It’s called sharp jquery. Angular is a framework and jquery is responsible for work at different levels. The two-way binding of Angular’s data DOM is relatively weak. Of course, many people think this is very powerful, because this feature is really convenient in weak structure and weak interaction pages. , in a page with a complex structure and strong interaction, the advantage of Angular's binding feature immediately becomes useless. There is no conflict between the two. Taking my work as an example, I understand Angular as the architectural structure of the house, including frame structure, frame-shear structure, and brick-concrete structure. I understand jquery as the decoration style of the house, including European, modern, and Southeast Asian styles. Now you understand, the two are independent, there is no conflict, and there is no selective comparison.
仅有的幸福2017-05-15 16:59:55
One is the MVC framework and the other is the library. One externally reflects the design idea, and one simplifies and strengthens the native js. We can also use jq to implement our own framework. So there is no comparison.
大家讲道理2017-05-15 16:59:55
AngularJS has successfully allowed Java developers to write this part better even when team members lack JS capabilities.
Programmers who lack js capabilities and are not proficient in DOM operations need AngularJS, an inefficient yet seemingly easy-to-use framework
So to put it bluntly, AngularJS is a crappy solution for Java programmers who lack JS capabilities and rely heavily on frameworks.
AngularJS is a heavyweight front-end framework, which means it is very performance-hungry and is suitable for places where page performance and interaction are not high. ;
淡淡烟草味2017-05-15 16:59:55
Comparison is just comparison. What is stupid or not? There are too many dimensions to compare. How many programmers have to go from being familiar with jQuery to learning Angular. This process will inevitably go through the comparison between the two. There are many trends in itself. More and more people are using angular instead of jquery, which may show who is more powerful, although I prefer jQuery.