0

Dear All expect out there, I'm a Java EE Developer which responsible doing web development in MVC architecture.

I wonder why there is need to use AngulasJs over conventional Javascript/Ajax/DOM manipulation.

Does this problem address by AngulasJS ?

  1. Changes of a drop down box value triggers changes to another UI component.
  2. How to address AJAX call in AngulasJS ?
  3. How to handle JSON since AngulasJS is POJO ?
  4. How to handle Javascript logic (Delete a row in JQuery Data Table) or ?

What are the benefits of using AngulasJS ?

Thanks.

PS EDIT:

Well, there is great answers out there that address my issue. Therefore, this thread should be close. Below are the links to the Why AngulaJS:

  1. Why AngulaJS ?
  2. Think in AngulaJS
Community
  • 1
  • 1
nicholas
  • 2,581
  • 14
  • 66
  • 104
  • 3
    http://stackoverflow.com/questions/18414012/why-use-angularjs-instead-of-jquery – Gus de Boer Nov 05 '14 at 12:35
  • 3
    Probably the most important statement from that very good answer: "Angular and jQuery can't reasonably be compared." – isherwood Nov 05 '14 at 12:43
  • I'm need to made a decision whether to proceed our next application using cutting edge front end technology like AngularJs. – nicholas Nov 06 '14 at 14:34

1 Answers1

1

AngularJs has a few more features then jQuery:

  • jQuery main use is to manipulate DOM, plus a few other utilities, like ajax handling
  • AngularJs, more then a library it is a framework, and it uses/presents a MVC/MVVM architecture. the Angular architecture, basically separates UI from logic - a thing that jQuery dose not offer. one of the most important and useful things Angular offers, is the 2-way-data-binding.

a classic example for two way data binding would be:

in the view:

<input ng-model="scope_variable" />

and in the js:

$scope.scope_variable = 'test';

any change in the input, changes the variable value in the js, and also the other way works, and any change in the variable value, changes the input value to.

read more, and try it out here: https://docs.angularjs.org/tutorial/step_04

as for your questions:

  1. a drop down change could be triggered via angular, or via jQuery, it would depend on the specifications of the entire app, and how big it would be - when Angular is used for bigger and more sophisticated apps, an jQuery for simpler and smaller apps.
  2. Angular has a service for dealing with ajax, pretty simple and not drastically different from jQuery.ajax. for example:

    $http.post('/url-to-ajax',{data:1}).sucsess(function(response) {
        console.log(response)
    });
    
  3. angular has 2 functions to change from string to json, and from js object to json string:

    var obj = angular.fromJson(jsonStr);
    var jsonStr = angular.toJson(obj);
    
  4. what is a jQuery data table? I may have misunderstood you.

MoLow
  • 3,056
  • 2
  • 21
  • 41