Friday, August 7, 2015

AngularJS – Load drop down list from sql (API)

I have a lookup table in SQL with the values I need in the drop down list.

Starting with:
  1. Lookup Model

  2. WebApiConfig.cs in App_Start

  1. Create an API controller

    I'm using Entity Framework, so I right clicked on Controllers, Add, Controller. I then selected Web API 2 Controller with acitons.

  2. Override the routing to create a different type of call

    *** Great overview of Custom Routing -

  3. Create SetLookups function in the AngularJS controller script

  4. Call SetLookups from AngularJS controller

  5. Create Select tab using ng-options to load