Why Angular?

Life Before Angular

What was life like before Angular?

It was like this:

$('.' + className + '[' + attrLookup + '^=' + attrPrefix ']:not(.' + notClass + ')');

And like this:

$('#something')
    .append('<div class="gall"><a href="javascript:void(0)">Linky</a></div>')
    .append('<div class="gall"><a href="javascript:void(0)">Linky</a></div>')
    .append('<button onclick="app.doStuff()">Button</button>');

And a little bit like this:

$('a').addClass('reg-link')
    .find('span')
        .addClass('inner')
    .end().end()
    .find('div')
        .mouseenter(mouseEnterHandler)
        .mouseleave(mouseLeaveHandler)
    .end()
    .explode();
Does Angular REPLACE jQuery?

In a sense YES, Angular replaces jQuery. jQuery has served us well for years in making DOM interactions better. However, nowadays web applications are becoming more than just simple static pages, or pages that need a little scripting. Web applications have morphed into products and systems that perform a lot of thinking and need to be robust.

Angular uses jQuery

Angular uses a very stripped down version of jQuery under the scenes to work with DOM elements.

Angular uses MVC

The Model-View-Controller paradigm allows for robust, modular applications.

Other Awesome Benefits

Some of the major selling points of Angular are:

  • Single page applications
  • No need to load completely new pages
  • Dependency injection
  • Inject other services and modules into your code
  • Templating
  • This means less lines of code in your main HTML files
  • Re-usability
  • Create your own HTML tags and attributes to be re-used anywhere
  • Led/Backed by Google
  • Framework decisions/revisions are made with great care
  • Separates Javascript from HTML
  • Keeps HTML clean, keeps Javascript clean and more robust