What AngularJS Isn't


  • It is not a databinding library like Knockout, or a catchall 'glue' library like jQuery.

  • It does not depend on or derive any of its functionality from any other external JS libraries (Okay, it bundles jQLite, but that barely counts).

  • It doesn't have anything to do with look and feel, you want Bootstrap or homerolled stuff for that.

What Is AngularJS, Really?


  • It is a full-on clientside single page application (SPA) framework.

  • It does:
    • 2-way databinding
    • Routing
    • View orchestration
    • Depedency injection
    • DOM-based templating
    • Custom HTML components
    • etc.

How Angular Does MVVM


  • What you need to do MVVM, in a nutshell:
    • A bespoke model for each view, with 2-way databinding being the sole link between the "view" and this "view-model".

  • This pattern was primarily devised by Microsoft to fix inherent problems in how their desktop apps were designed and built, but it can be used for web apps as well.

How Angular Does MVVM, Cont.


  • Angular officially supports MVW.

    a.k.a. "Model-View-Whatever"


  • The basic AngularJS application structure is
    • Standard HTML (View).
    • A scope object databound to the view, decorated with a "controller" class (consider this the ViewModel).
    • And "services" (either core Angular services or ones you wrote) which are injected into the controller class constructor by the Angular DI mechanism. (this maps to the Model).

How Angular Does Databinding


How Angular Does Databinding, Cont.


  • Angular does not use change listeners or "observable properties" like Silverlight or Knockout in an effort to avoid the overhead those techniques bring with them.

  • It also uses your POJOs directly, no special calls, inheritance or other setup.

  • Instead it uses "dirty checking."

Ridin' Dirty


To contrast dirty-checking (AngularJS) vs change listeners (KnockoutJS and Backbone.js):

While dirty-checking may seem simple, and even inefficient (I will address that later), it turns out that it is semantically correct all the time, while change listeners have lots of weird corner cases [e.g. change coalescence and change listener synchonization] and need things like dependency tracking to make it more semantically correct.

KnockoutJS dependency tracking is a clever feature for a problem which AngularJS does not have.

--Misko Hevery

They See Me Checkin', They Hatin'


  • So this dirty checking technique seems like it'd be slow, right?

  • In reality, it's really fast. Turns out most browsers from IE8 on up are really good at executing Javascript quickly.

  • 10,00 listeners on a single page: 6ms on a recent browser, 40ms on IE8.
    Anything under 50ms is pretty much instantaneous from a human perspective.

  • Benchmarks should be taken with a grain of salt, but it's pretty clear that dirty checking can be as fast (or actually faster) than other methods.

Angular Testability


  • Angular uses dependency injection for everything: scopes, controllers, services.

  • Because the scope and services are DI'd into the controller, you can mock/isolate any of those pieces easily.

  • Angular comes with built-in mocks for all of the core Angular services, including a mock HTTP provider to inject fake server responses into controllers.

  • It becomes very easy to cover all of your logic with a unit test runner like Jasmine, completely independent of the UI.

Angular and ASP.Net


  • ASP.Net isn't built for single page applications. The top hit for SPA development on http://www.asp.net/ uses AngularJS and WebAPI.

  • For that and other reasons, ASP.Net isn't currently very popular in the webapp world these days.

  • Microsoft is radically retooling ASP.Net right now in an attempt to keep up, as well as adding first-party support for Angular and other JS tools to Visual Studio.

  • You can use Angular with ASP.Net MVC, but it's a bit redundant and silly since you have 2 frameworks with overlapping functionality.

Angular and ASP.Net, Cont.


  • Using Angular for the client and .Net serverside logic via a WebAPI or WCF RESTful API is a very nice solution on the other hand.

  • This leverages the best of both worlds, will Just Work, and is miles away from the fragile, boilerplate-laden stuff you used to need to use web APIs in clientside Windows apps.

Future Shock: Angular 2.0


  • Angular 2.0 is the next version of Angular, it's about 2 years away at this point.

  • It will address and simplify a lot of the more arcane aspects of Angular, like directives, while improving performance, nuking the jQLite dependecy and DOM wrappers in general, and being coded in an ES6-based superset of Typescript.

  • It will also break compatibility with 1.x, which will continue to get security and bugfixes.

  • "Once we have an initial version of Angular 2, we'll start to work on a migration path for Angular 1 apps."

    --AngularJS Team Blog

Future Shock: Angular 2.0


  • Takeaway: 1.x is great and 2.0 will be even better. If you're building something now use 1.x, if you're building something 3-4 years from now wait for 2.0.

Recap: Where It Makes Sense To Use Angular


  • If you're not already using some other full-on webapp framework like ASP.Net MVC or Ember or whatever.

  • If you want to build an SPA.

  • If you want a testable and up-to-date clientside for your web application.

Recap: Where It Doesn't Make Sense To Use Angular


  • If you're already using some other clientside webapp framework.

  • If you're building a trivial web application that you aren't going to extend much and Angular is more than you need.

Copy of deck

By Praveen Poonia

Copy of deck

  • 854