ASP.NET Web API/AngularJS SPA Demo App Updated (webapi-angularjs-spa v1.2.0)
We have released an updated version for the single page application (SPA) demo built with ASP.NET Web API 2 and AngularJS. The current version (v1.2.0) of the demo app available on github at https://github.com/MarlabsInc/webapi-angularjs-spa. The following are the new features added in the webapi-angularjs-spa v1.2.0:
- Added unit tests for client-side JavaScript with Jasmine.
- Added paging with ng-Table.
- Role based security for both server-side and client-side.
Here are the complete set of features in the current version:
- REST API with ASP.NET Web API 2.
- Server-Side security with ASP.NET Identity.
- Single Page Application(SPA) with AngularJS.
- AngularJS factory $resource for interacting with RESTful server-side data sources.
- AngularJS $http interceptors.
- AngularJS directives.
- Task automation with Gulp.js
- Unit tests for client-side JavaScript with Jasmine.
- Paging using ng-Table.
- Role based security.
JavaScript Unit Tests With Jasmine
In the current release, we have included unit tests for client-side JavaScripts, written with Jasmine. This provides unit tests for AngularJS Conrollers and Services. To run the unit tests, navigate to the directory of ResourceMetadata.Web project in command prompt, and run the command gulp tests which will redirect to the page SpecRunner.html, where results of the tests can view as shown in the below figure.
Role Based Security For The SPA
The current version provides role based security for both server-side and client-side. The write opeartions for Location entity is restricted with admin user. For a normal user, UI elements for creating new Location is removed when the view templates are loading and the templates will put on the cache.
The figure below shows the UI of Location page for a normal user.
The figure below shows the UI of Location page for a admin user.
Source Code
For more information on the project and to download the source code, check out https://github.com/MarlabsInc/webapi-angularjs-spa