Using an Abstract AngularJS factory to populate a KendoUI DataSource from an OData Endpoint


What's In Your Lunch

Since being introduced to AngularJS, I have enjoyed how robust the framework is, and provide a great layer of abstraction to enable client-side unit testing.   Creating an abstract factory that takes in parameters isolates the client-side data access point and makes it easily testable.

My reason for writing this is that I was unable to find any sources that gave a full end-to-end example (let alone integrating a KendoUI datasource with AngularJS and OData).  KendoUI’s datasource transports make it really simple to connect to an OData endpoint, but I want to Angularize my data calls.

Setup

To manage ContentType data, I used a KendoUI grid to handle all CRUD operations from a simple, intuitive interface.  Using Entity Framework, MVC5, WebAPI2, I exposed an OData endpoint at ~/odata/ContentType.

Setting up an OData endpoint through WebAPI is out of the scope of this article and using VisualStudio 2013 makes it quite simple…

View original post 663 more words