When comparing Vue.js vs Angular, the Slant community recommends Vue.js for most people. In the question“What are the best client-side JavaScript MV* frameworks?” Vue.js is ranked 1st while Angular is ranked 9th. The most important reason people chose Vue.js is:
Vue can easily be integrated with other front-end libraries. This makes it an extremely versatile tool and it's easy to fix its shortcomings or missing features by just plugging in another library.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Can be used with any front-end stack
Vue can easily be integrated with other front-end libraries. This makes it an extremely versatile tool and it's easy to fix its shortcomings or missing features by just plugging in another library.
Pro Single file component
Very useful.
Pro Lightweight
Vue.js weighs in at 16kb min+gzip.
Pro Vuex store, events system
Pro Reactivity system
Pro CLI and Webpack integration
Pro Responsive server-side rendering
Since most of the mainstream server-side rendering implementations are synchronous, they can block the server's event loop when the application is complex.
Vue implements streaming server-side rendering, which allows you to render your component, get a readable stream and directly pipe that to the HTTP response. This allows you to have a responsive server and decreases the time your users have to wait before they get your rendered content.
Pro Supports inline templating
Although you can build components in JavaScript files, you can also use inline handlebars-like templating in your HTML views where simplicity is often a more sane choice.
Pro Can be made even lighter
Since the template-to-virtual-DOM and compiler can be separated, you can compile the templates in your machine and then deploying only the interpreter which is 12KB minified and gzipped.
Pro Support for both templates and JSX
You can choose to use either a templating language, or if you feel it's necessary to drop on a lower virtual-dom level, you can use JSX. This is simply done by replacing the template
option with a render
function.
Or alternatively, you can embed functions inside templates by using the <render>
tag.
Pro SEO friendly
Starting with Vue 2.0, Vue supports server-side rendering. This helps with SEO a lot, since the views are rendered directly on the server, which are indexed by search engines.
Pro VueRouter
Pro Support for a composable component oriented architecture with directives
Angular uses the existing HTML structure and builds on top of it instead of requiring you to learn a new templating language. Because it's just vanilla HTML, it is more familiar, and easier for beginners to learn. Directives let Angular know which HTML elements are under its control, and how to use them.
Being directly on the HTML it's more transparent what's going on, and it's possible to get a good idea of what the page is doing just by looking at the template.
Also, it makes embedding possible, as you could have an angular app within an existing site so you don't have to rewrite everything at once.
Pro Easy and straightforward data-binding
Data bindings are done on the DOM, which allows you to easily sync data between various parts of the DOM in a very succint matter.
<body ng-app>
<span>Insert your name:</span>
<input type="text" ng-model="user.name" />
<h3>Echo: {{user.name}}</h3>
</body>
This snippet shows how the model attribute "name" is easily bound across different parts of the DOM without having to set up any extra boilerplate.
Pro Provides dependency injection
With dependency injection, you can load in extra javascript and new functionality just when you need it.
This is particularly helpful with testing as you can swap out services for test services.
It also means in single page apps you can load dependencies only as you need them instead of loading them up all up at the start.
Pro Huge ecosystem of third party components
Angular is an extremely popular JavaScript framework. Because of this, developers have developed a myriad of components which can be downloaded and integrated into any Angular application.
Pro Huge community that is quickly growing
Angular has the largest community out of all Javascript MV* frameworks and there are a lot of tutorials and guides out there for new and old users alike.
Pro All best practices
Cons
Con Poor typescript support
Very basic typescript support.
Con Very enterpris-ey in design and tooling
Con Steep learning curve
Angular isn't a simple framework, and because much of the magic goes on behind the scenes, it isn't easy to go from simply using the framework to being able to actually change how it works and extend it.
Con It is almost mandatory to use Typescript
Although ES standard can be used, most of the documentation and resources are with Typescript.
Con HTML template does not comply to standards
Attributes are case-sensitive, which is against the HTML standards.
Con Difficult to use for isomorphic apps that render the initial template on the server in a performant way. Non issue for enterprise apps.
Con Explicit configuration
Users will usually need to specify stuff that is very obvious (template location, providers etc. ).
Con Two-way data binding is often considered an anti-pattern
Two-way data-binding means that a HTML element in the view and an Angular model are binded, and when one of them is changed so is the other. One-way data-binding for example does not change the model when the HTML element is changed.
This is a rather controversial subject and many developers consider two-way data binding an anti-pattern and something that is useless in complex applications because it's very easy to create complex situations by using it and being unable to debug them easily or understand what's happening by just looking at the code.