What is the point of Angular JS vs Java Script?

Hi,
For sometime I have been reading on Angular JS, taking courses that I have got 100% right on tests, etc.
But the more I read on this, I do not see what is the point of this?
Why not just use Php, JavaScript and AJAX to dynamically change the content of a Web page? What is the point of the Angular JS which just seems like a more cumbersome way of dynamically changing the content of a Web page!
And on top of anything you can do in AngularJS you can do it with JS & AJAX and Php is that everything done server side is secure while same is not true on client side.

Thanks,

Hello!

Angular can’t take the server-side away. It is possible that in these courses, they leave out the rest of it to you. So instead of a real database, they use localstorage and the like. No web-app developer can

Like any framework, Angular tries to offer tools to deal with the daily problems of a front-end developer.
Are you talking about Angular or Angular JS? AngularJS is the first version and is outdated. They tried to work around a lot more problems than what exists today. E.g. Module bundling.

AngularJS would asynchronously load the other modules you would require in such a fashion:

angular.module('myModule', []).
config(function(injectables) { // provider-injector
  // This is an example of config block.
  // You can have as many of these as you want.
  // You can only inject Providers (not instances)
  // into config blocks.
}).
run(function(injectables) { // instance-injector
  // This is an example of a run block.
  // You can have as many of these as you want.
  // You can only inject instances (not Providers)
  // into run blocks
});

This is no longer a problem today, as you can simply import the files and modules you need. If you use a module bundler like Webpack.

import {HttpClientModule} from '@angular/common/http';

Angular tries to offer a component-based approach. This is easy to overlook, when you are faced with a lot of other complexity.
So the idea is to write something only once. Where in jQuery, they perpetuate, that you should use an ID selector for every single functionality. I can’t tell how often devs using jQuery apply the same function over and over to different IDs.
In Angular, you are supposed to write customizable components. Very much like the components you find out in the wild.
Dropzone, Flatpickr, nouislider or flickity. All UI components that are highly customizable. You are supposed to work like that, instead of writing controllers that you use only once. This requires a lot of thought and is not easy at all at first. This is a complete mindset shift away from jQuery and similar.

Angular can’t completely replace Javascript (as it uses javascript)
Once you hit the limits of Angular, you need to resort back to the DOM API. But they offer a quite huge templating engine.

If you are looking for a more lightweight component-bases approach. I can only recommend Riotjs. Which requires you to write less (no more remembering what a service, a module, a pipe, a controller, etc is) to achieve more.

On my website, you can find a lot more working examples and a guide to get started with functional components. If you still have a hard time, deciding which framework is the best for you.

1 Like

Yes, on I am referring to Angular JS on client side only. So my point is what is the point of this Angular JS?
Why not just code in pure JavaScript CSS DOM API, with AJAX if you need not loading the page, rather than use this Angular JS than adds a multi layer of complexity to the code on client side. I think one of the missions of creating great software, is to get the Job done while creating clean simplest code you can. And it seems to me there is no new capability that Angular offers us over pure JS + AJAX, except multi layers of harder to read code. Dont you agree?

Some more on this realization that these Java Script Frameworks by Google and Facebook, that is Angular and React JS, are really bad ideas for creating well coded Sites (Internet services) in todays World where you can do everything that these FrameWorks do in plain Java Script, but in most cases with much less code, plus other reasons.

So why Java Script frame works are a BAD idea in todays World.
Well, one of the problems of frameworks is usually one of their selling points, that they abstract away the platform so you can concentrate on building your own software. The problem is that now you have two systems to learn, HTML+CSS+JS, and the framework.

Simply put: I think it’s time to rethink the model of JS frameworks. There’s no need to invent yet another way to do something, just use HTML+CSS+JS.

There is good related article here:

There are many arguments for and against frameworks and libraries…
Find a framework that matches your style of fixing problems. If you are fine with eventhandlers, DOM manipulation on your own and are certain, that it will perform to your needs, that’s okay!

However, I try to avoid reinventing the wheel everytime I create a web-app.
Which is why I try to find libraries on NPM that do what I want.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.