Skip to content

A set of libraries for extending Angular functionality

License

Notifications You must be signed in to change notification settings

idlemachinery/ng-idle

Repository files navigation

ng-idle

GitHub version

Custom libraries that provided extended functionality to Angular. I have included some common code that I have gathered throughout the Pluralsight Angular skill learning path.

The main application contains examples and is on StackBlitz. Click 'Install Missing Packages' and 'Install Missing Dependencies' to get it running.

This project was generated with Angular CLI version 7.2.2.

Libraries

ng-idle-common

npmjs

Commonly needed directives and services

  • Capitalize and Trim pipes
  • EnsureModuleLoadedOnceGuard for core & other modules

ng-idle-forms

npmjs

Directives and services for creating forms

  • Autofocus directive
  • FormValidators including range and restrictedWords
  • GenericValidator class for Reactive Forms
  • ValidationForm that implements GenericValidator and can be extended
  • IdleFormsModule & IdleReactiveFormsModule export FormModule & ReactiveFormsModule respectively

ng-idle-http

npmjs

The http service

  • AddHeaderInterceptor & AddXmlHeaderInterceptor for adding application Content-Type to the headers of http calls
  • GenericDataService is an abstract class that provides get/post/put/delete functionality for generic types

Outstanding items

  • Code comments & documentation
  • Unit tests for all features

Possible future enhancements

  • Directives for the validation functions so they can be used in template-driven forms
  • Http Interceptors for logging & caching
  • Extensible logging service

Running the example application

Run ng serve or npm start for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the application source files.

Running unit tests

Run ng test or ng test ng-idle-common or ng test ng-idle-forms or ng test ng-idle-http to execute the unit tests via Karma.