Tips for using AngularJS in ASP.Net MVC

Working at Envoc I live in the .Net world. We have a lot of talented developers that can solve just about any domain problem with the given toolset. And I personally find developing in Visual Studio quite nice (Web Essentials and Resharper take it to the next level). I am currently helping move a lot of our front-end work into the AngularJS realm and decided to share some of the things that might make the .Net developers life a little better.

Application Inception

While Angular is a framework for the modern Single Page App, I have found that a lot of our MVC applications call for a collection of these “ng-apps”. In this instance they typically don’t include the client side routing.

Continue reading

Keeping Angular “service” list data in sync with controllers.

Learning Angular has been one of the greatest productivity boosts for rapid application development in my career. However, some of the common strategies implemented can be improved in my opinion.

In AngularJS, there is a great deal of importance placed on separation of concerns. One of the most practiced patterns for holding application state is move this data into angular services or factories. Which one of the former to use is totally a personal preference in my opinion (I opt for factories most of the time).

The purpose of this post is aimed at services that hold collections that update from remote data calls.

Targeted AngularJS version at time of writing: 1.2.19

Too many times, I have run across angular controllers bringing in the $scope service just to $watch a service collection:

The bad:

Continue reading