When comparing Ember vs Angular, the Slant community recommends Angular for most people. In the question“What are the best client-side JavaScript MV* frameworks?” Angular is ranked 9th while Ember is ranked 16th. The most important reason people chose Angular is:
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.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Opinionated in terms of application structure
Ember already defines the general application structure and organization for you. This was done to prevent developers from making mistakes which would needlessly over-complicate their application. While it's still possible to go out of these practices forced to developers by the Ember authors, you still have to go out of your way to force them.
Pro Ember-CLI
Ember-CLI is a very useful tool. With just a couple of commands it scaffolds the code, installs dependencies and finally compiles everything itself. It's very useful to quickstart an Ember project.
Pro Uses Handlebars
Ember's preferred templating language is Handlebars. This is mainly because Handlebars is a logic-less templating language and Ember tries to keep it's logic outside the view.
Another reason why Ember benefits from Handlebars is mostly aesthetic as Handlebar's clean syntax makes for easier to read and understand templates.
Finally, Handlebars templates are compiled instead of interpreted, which means that they are much faster to load.
Pro Convention over configuration
Ember follows the philosophy of "convention over configuration" meaning that it already has almost everything configured for you, so you just have to start coding and developing your project right away.
Pro Complete front-end stack
Ember is practically a complete full-stack front-end framework. It comes with it's own asset pipeline, router, services etc...
Pro Completely community based
Pro One of the fastest template rendering engines (new glimmer)
Pro Easy to understand documentation
The Ember Guides are well structured and very well written. The API documentation is also fantastic.
Pro Ember's Object model makes the framework extremely consistent
Most of Ember's components come from the Ember Object Model. It's the basis for views, controllers, models and even the framework itself. This means that the framework is extremely consistent since almost every component shares the same core functionalities and properties since they are all derived from the same object.
Pro Excellent routing
Route handlers for the URLs can see a wide range of possible application states, asynchronous logic in the router makes sure of Promises. And implementing makes sense.
Pro The run loop
It batches bindings and DOM updates to increase performance; if similar tasks are added to a batch, the browser would only need to process them in one single go, as compared to re-computing for each task one at a time.
Pro Excellent API
Ember's API are really easy to understand and work with. It has methods which allow you to harness complicated functionalities in an easy to understand way.
Pro New router has less boilerplate code
Ember's new router need much less boilerplate code that it previously did.
Pro Debugging tool for almost every web browser
Ember also has a debugging tool called Ember Inspector which is used for debugging the client side of your app.
Pro Works great with jQuery
You can use any of jQuery’s features.
Pro Useful bindings
EmberJS provides with an extremely handy feature of advanced bindings. With this you can not only set the path to the binding value in your app but also set in which direction you want the changes to propagate to (oneway
, single
, multiple
etc).
Pro Promises everywhere
Promises represent an eventual state in asynchronous logic. Having promises everywhere (almost) means you could write simple and modular code, using almost any API that Ember provides.
Pro Computed properties
Having custom properties in your templates is itself a huge plus but having custom computed properties is an even greater benefit, since now you can code your custom function as a property and call it from your template. Hence rendering your page exactly according to your needs.
Pro Built-in router
Ember comes with built-in routing capabilities. There's no need to install third-party plugins to be able to use routes.
Pro Auto-updating templates
If you've used handlebars (Ember.js's templating is powered by HandleBars) helper tags in your code (like {{#each}}
) you won't have to worry about updating your template each time you add/remove data from your page, Handlebars will auto update your template for you.
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 Large library size
At 69Kb gzipped, it is one of the largest JavaScript frameworks. This means Ember might be an overkill to use on simpler projects.
Con Very opinionated
Ember (and many extensions, like Ember Data) force the implementation down specific architectural paths. These paths are what Ember believes is best practice and typically are fine, but not in all cases. This can occasionally lead to fighting with your framework which is never productive.
Con Partly unfriendly community
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.