ngx-cho-common
v2.0.0
Published
This library provides common utilities, models, services, and directives shared across CHO Angular applications.
Downloads
293
Readme
NgxChoCommon
This library provides common utilities, models, services, and directives shared across CHO Angular applications.
Generated with Angular CLI version 17.3.0.
Overview
NgxChoCommon is a foundational library that contains:
- Common models and interfaces
- Utility services (error handling, session storage, etc.)
- Reusable directives
- Configuration interfaces
- Shared pipes and guards
Dependencies
This library has no dependencies on other workspace libraries and should be built first.
Peer dependencies:
@angular/common@angular/core@js-joda/corefile-savermoment
Installation
npm install ngx-cho-common momentBreaking Changes
ChoModalService has been removed. Applications should replace it with an app-local dialog implementation, such as a native dialog or a PrimeNG dialog/drawer. This library no longer depends on ng-bootstrap.
ngx-spinner and ngx-toastr peer dependencies have been removed. Applications that want CHO guards to show notifications should provide the optional CHO_NOTIFICATION_ADAPTER token.
Optional UI Adapters
import {
CHO_LOADING_ADAPTER,
CHO_NOTIFICATION_ADAPTER,
ChoLoadingAdapter,
ChoNotificationAdapter,
} from 'ngx-cho-common';CHO_NOTIFICATION_ADAPTER is used by ChoFeatureGuard when a feature is disabled. CHO_LOADING_ADAPTER is exported for sibling CHO libraries, such as ngx-cho-security, to show app-owned loading UI. Both tokens are optional; the library still works when they are not provided.
Build
Important: This library should be built before any other libraries in the workspace that depend on it.
ng build ngx-cho-commonBuild artifacts will be stored in the dist/ngx-cho-common directory.
Development
Code Scaffolding
ng generate component component-name --project ngx-cho-common
ng generate service service-name --project ngx-cho-common
ng generate directive directive-name --project ngx-cho-commonNote: Always include
--project ngx-cho-commonor the component will be added to the default project.
Running Tests
ng test ngx-cho-commonPublishing
- Update version in
projects/ngx-cho-common/package.json. Use a major version for the modal-service and UI dependency removal. - Build the library:
ng build ngx-cho-common --configuration production - Publish to npm:
cd dist/ngx-cho-common npm publish
Usage in Other Libraries
Other libraries in this workspace depend on ngx-cho-common:
- ngx-cho-security
- ngx-cho-components
Make sure to build ngx-cho-common first before building dependent libraries.
