Home

Awesome

Customer Manager with AngularJS (with custom routing and dynamic controller script loading)

If you’re new to AngularJS check out my AngularJS in 60-ish Minutes video tutorial or download the free eBook. Also check out The AngularJS Magazine for up-to-date information on using AngularJS to build Single Page Applications (SPAs).

Also check out my <a href="http://tinyurl.com/angularjsjumpstart">AngularJS JumpStart</a> video course:

<a href="http://tinyurl.com/angularjsjumpstart"> <img height="225" width="400" src="CustomerManager/Content/images/CourseLogoYellow.png" border="0" /> </a>

Customer Management App

This version of the application has support for custom routing and dynamic controller script loading. See this this post for more details. The standard version of the application with no custom routing can be found here.

This application demonstrates:

The factories can be switched by changing the app/customersApp/services/config useBreeze setting to true.

The AngularJS portion of the app is structured using the following folders:

Customer Management App Structure

Requirements:

If you're using Visual Studio and .NET:

The following is required to support the backend services:

To get started, double-click the CustomerManager.sln file located at the root of the CustomerManager repository. Once the solution loads press F5 to run the project.

Note: If you want to use Visual Studio 2013 that should work although you may have to change the connection string in web.config from "MSSqlLocalDB" to "v11.0" depending upon which version of LocalDB you have installed.

If you're using Node.js/Express/MongoDB

If you don't already have Node.js on your machine install it from http://nodejs.org. You'll also need to install MongoDB from http://www.mongodb.org if you don't have it already and get it configured and running using the instructions on their site.

In the CustomerManager directory execute 'npm install' to install Express, MongoDB and Mongoose (package.json).

Load MongoDB Sample Data Option 1:

Load data into MongoDB by performing the following steps:

Load Sample Data Option 2:

Alternatively you can navigate to CustomerManager/server and double-click the initMongoData.bat (Windows) or initMongoData.sh (Mac/Linux) file to initialize MongoDB with the data.

The Windows script assumes that MongoDB is installed at c:\mongodb while the Linux/Mac script relies on the fact that you have the monogo executable in the path.

Start the Node/Express server:

View the application at http://localhost:3000

Thanks to Tony Quinn for contributing the initial Node.js/MongoDB code!