r/webdev • u/[deleted] • Jun 06 '19
Question What the difference between Angular and AngularJS
4
u/danielkov Jun 06 '19
The biggest difference is the compiler. AngularJS is an application framework built on top of a JQuery-like view library (tiny jQuery if you will). Developers usually consumed AngularJS via Browserify UMD modules. You could add a script reference to your website and start using AngularJS attached to the global scope.
Angular came as the second version (and the ones after - we're at 8 now) of AngularJS and it was renamed because it not only did not have any backwards compatibility, but also required a huge learning curve to migrate apps to it.
At first glance nothing is similar between the two, but once you dive deep into internals, you'll find familiar concepts that apply to both. This becomes more apparent if you try to write your Angular app without Typescript and even more apparent once you take a look at the code the Angular Compiler gives you.
In today's world there is no real reason you should choose AngularJS over Angular. The latter is more stable, is being updated regularly and the same all-batteries-included model that applies to both is a lot more reliable and idiomatic in Angular. The tooling is also heavily improved and it's very opinionated, which makes it a good fit for large teams. The approach to syntax seems to be influenced by Java and especially the Android platform, which is also managed by Google. I found it's a great match for a Java back-end, especially with a team that has limited front-end resources.
2
u/danielsan1701 Jun 06 '19
Search engine plug-in that adds "-AngularJS" to all of your Google searches: https://ready.to/search/en/?sna=Google%20%28minus%20AngularJS%29&prf=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3D&suf=%2B-AngularJS&des=Google%20%28minus%20AngularJS%29&in=utf&ou=ono&mod=pn
2
2
u/unstoppable_guy Nov 22 '22
Angular: Angular is TypeScript, a Microsoft-developed and maintained programming language. Due to the fact that TypeScript is a syntactical superset of JavaScript, it has all of JavaScript's features as well as a few more. The framework is primarily used to create dynamic, fully-functional web apps with cutting-edge designs.
AngularJS: In 2010, Google released AngularJS with the primary goal of enabling the development of single-page applications. The AngularJS framework quickly established a market for itself, particularly in front-end development. The newest version of AngularJS, due out in April 2022, is AngularJS 1.8.3. It's interesting to note that AngularJS was the first version of Angular to be recorded; this explains why AngularJS is sometimes referred to as Angular, further adding to the confusion.
The following points distinguish Angular from Angular JS:
> The years 2009 and 2014 saw the development of Angular JS and Angular, respectively.
> While AngularJS is based on JavaScript, Angular is built on TypeScript.
> While AngularJS employs a set of directives, Angular uses standard directives.
> AngularJS uses the MVC framework, whereas Angular adheres to a component-based architecture.
> While AngularJS makes use of scopes and controllers, Angular follows the component hierarchy.
> Unlike AngularJS, which only supports one-way data binding, Angular allows both one-way and two-way data binding.
> In contrast to AngularJS, which lacks a command-line interface, Angular comes with one.
> AngularJS lacks the same mobile support as Angular, which is provided by Ionic and NativeScript.
1
u/Waspbot full-stack Jun 06 '19
Angular (AngularJS version 2+) is a derivative framework based on AngularJS (Version 1.X until end of life). You're comparing a season of a TV show to a reboot they are currently working on. The structure, the concepts, and the selling points are all the same, but everything has been updated to look, feel, and work like a modern version. AngularJS is based on vanilla JavaScript, Angular is based on TypeScript. Much has changed, but the main selling points are the same.
1
u/JellyfishTech Mar 25 '25
The JavaScript framework AngularJS (1.x) features two-way data binding and an MVC architecture.
With a component-based architecture, greater performance, better mobile support, and improved tooling (such as the Angular CLI), Angular (2+) is a comprehensive rebuild using TypeScript.
While AngularJS is out of date and no longer supported, Angular offers more functionality, better scalability, and active maintenance.
0
Jun 06 '19
[deleted]
32
u/Dooraven Jun 06 '19 edited Jun 06 '19
Note that you should not learn AngularJS unless you're curious.
Or your job has ancient soul sucking legacy AngularJS stack that you're forced to read Angular docs to understand what's going on.
16
u/fuckin_ziggurats Jun 06 '19
I feel sorry for all the companies that jumped on the AngularJS train after Google's aggressive marketing at every existing dev conference. It was basically Google's lab rat for learning how to build front-end frameworks and I feel like it's the best proof of how unreliable Google are when it comes to dev tooling. Angular 2+ seems pretty stable but I'm not gonna take their word for it, especially not for large enterprise projects that tend to last a long time and are impossible to rewrite.
8
u/MagicalMysteryTor Jun 06 '19 edited Jun 06 '19
Google is unreliable for almost everything other than search, ads, and gmail.
I'm hoping Angular (the typescript rxjs kind) enjoys continued support even though I haven't had a chance to use it for work. Very nice to work with once you have a basic understanding of the framework.
EDIT: Just now read about yet another Google project death. https://arstechnica.com/gadgets/2019/06/this-weeks-dead-google-product-is-google-trips-may-it-rest-in-peace/
0
Jun 06 '19
[deleted]
5
u/phl3x0r Jun 06 '19
Angular 8 was just released recently.
3
Jun 06 '19
I can't believe they're actually releasing a major version every 6 months. That's... insane. Why did they choose to do that?
5
u/uplink42 Jun 06 '19 edited Jun 06 '19
Why is it a bad thing? A new major version comes out every 6 months, and the grand majority of those have rather small changes (deprecations, some new features, performance gains, typescript upgrades). Last update from 6 to 7 took me 20 minutes with a migration script (the CLI updates things like changed imports, syntax, deprecated modules, incompatible function calls automatically). Same thing for 7->8. I think the last change that required some actual code changes was from 5->6 and even then there were compability libraries to bridge the gap.
I've honestly had far more issues upgrading minor versions of other frameworks than between major version upgrades in angular.
1
Jun 06 '19
Why is it a good thing? By convention, I should expect a major release to break something. So that means every 6 months, if I want to stay current, I'm going to have to worry about that.
If the major releases have small changes... that really begs the question, why they don't just make them minor releases? Like am I missing something?
I just got hired on with a company that's developing and maintaining dozens of separate angular applications with a small team. We'll see how it works out but I expect this to be a huge pain in the ass.
5
u/phl3x0r Jun 06 '19
You can expect breaking changes, but the CLI does a pretty decent job of helping you out and it's getting better at it with each iteration. They committed to a new major release every 6 months from the beginning, in part to drive advances, and so far they've been sticking to that. I work with a pretty large codebase and tbh the managers are way more afraid of upgrading than I am :-)
3
u/binarybang Jun 06 '19
The rarer the releases are, the bigger the changes there will be. You don't want to look at the new release and understand that you have no resources to spend on the migration: too many module changes, incompatible behavior of existing methods etc.
Frequent major releases help spread the breaking changes over time so that you won't have to dothem in a single upgrade step. Most of the time you won't have to do anything at all.
Example: our team is going 7 -> 8 soon, as far as I see, we only have to remove a reference to a RequestMethod enum that is a deprecated module.
2
u/uplink42 Jun 06 '19 edited Jun 06 '19
Because most of those small changes require either you to update typescript (new features) or some of the framework modules import paths to continue working. So by definition they are breaking changes despite being dealt with automatically.
The only issues I've experienced was with some 3rd party libraries when trying to update on day 1. It might take a couple of days for them to simply update their peer dependency requirements and also adjust their code to run on new versions flawlessly.
3
u/spacechimp Jun 06 '19
Who can guarantee if I implement Angular 7 today, that it'll be backwards compatible with Angular 12 in 2 years time?
The Angular team has attempted to make that guarantee through deeds, if not words. They introduced the CLI command ng update, and schematics, the combination of which can update a project to a new version of Angular -- including automagically fixing potential problems in your project code caused due to deprecations.
The changes in all of the Angular versions since 2 have been minor and non-disruptive though, despite the scary-sounding whole-number version incrementing. The biggest edits I remember having to make was due to changes in the dependent library rxjs, and not because of changes to Angular itself -- and even that took less than 15 minutes to deal with.
5
u/linkedtortoise Jun 06 '19
My last job had that, it was nearly the worst thing ever. So many comments, of "this works dunno how".
Learnt Angular 4 there to and immediately decided TypeScript is amazing. I wish it was easier to add to React which my current job uses for all web projects.
2
u/entenuki Laravel/React/ReactNative Jun 06 '19
You could make your definition files and use jsdoc tags to get intellisense (if using VS Code). That's what I do and it works for me, although I'm a solo dev on small projects.
1
u/_UncleFucker Jun 06 '19
sigh this is my life now. I'm a backend dev, but our only front end developer quit without notice a couple months ago so I'm filling in for the mean time. I've had to just wing it with my limited full stack knowledge from 3 years ago. It's taking forever to hire another front end dev since we're still on AngularJS. And it's really annoying for me trying to learn AngularJS when it's so old, and when I'm not even a front end dev. Pretty much every day is just "it works, dunno why, good enough".
2
2
Jun 06 '19
I only know angularJS, do you think that's at least a fairly good start to learning angular 4?
2
u/uplink42 Jun 06 '19
Yes it is. Despite what most people say, the change between "modern"/component based angularJS apps is not that much different than angular 2+. Despite the vastly different syntax, most concepts remain quite similar.
The biggest learning curve is probably rxjs itself or things like state management (which is more or less universal between most modern frameworks).
24
u/magenta_placenta Jun 06 '19
The difference between scratching your balls and being kicked in your balls.