Lance Larsen - .NET Architect Madison Wisconsin

Archive for January, 2014

Always loved JavaScript and client side scripting ( where appropriate <grin> ) – so when we had a new green field project to start, looked to what the best-in-class technologies were – settled on AngularJS (@angularjs). 

It is a client-side MVC (Model-View-Controller) pattern and it rocks for making SPA (Single-Page-Applications) that emphasize responsiveness.  Take a look at either the AngularJS site, or there are a couple great AngularJS videos on Pluralsight – specifically “AngularJS Fundamentals” and “AngularJS for .NET Developers”.

I know that I have a ton to learn about AngularJS – and wanted to share what I’m learning along the way…

Specifically, have a page that has a list of items to be displayed – and want to filter them by a parameter based on what the user clicked.  So in AngularJS we can separate showing the items to be displayed into one controller – the “CollectionController” – and the filters to be applied into another controller – the “FilterController”.  Found many examples / discussion on how to communicate between the controller, but some seemed to be way overkill or confusing – so got the following code crafted – and wanted to share as it turned out pretty slick! :)

To boot, have the live code running on JSFiddle – which again, if you haven’t played with is WAY awesome!

http://jsfiddle.net/lancelarsen/qjkyM/

Read more