Create Common Services Lib

Angular Common Services Lib

We are creating an Angular Common Services Lib so that we have a central location we can put our common services to be used within our applicaiton.

Benefits Of Having a Common Services Lib

Creating a common services library offers several benefits, including:

  1. Code Reusability: Shared services can be centralized in one library and reused across different parts of the application, reducing duplication and promoting maintainability.

  2. Consistency: By centralizing common services, you can ensure that consistent functionality and behavior is maintained throughout the application.

  3. Separation of Concerns: Common services can be separated from the main application code, leading to a more organized and modular codebase.

  4. Testing: Common services can be easily tested in isolation, leading to more robust and reliable code.

Conclusion

The Angular Common Services Lib simplifies the process of creating a common service library in an Angular project, promoting code reusability, consistency, and maintainability. By centralizing common services, developers can build more organized and modular applications.

angular icon
common-services.module.ts
typescript icon
index.ts
typescript icon
test-setup.ts
eslint icon
.eslintrc.json
markdown icon
README.md
jest icon
jest.config.ts
json icon
project.json
tsconfig icon
tsconfig.json
tsconfig icon
tsconfig.lib.json
tsconfig icon
tsconfig.spec.json
{
  "extends": ["<%= relativePathFromRoot %>.eslintrc.json"],
  "ignorePatterns": ["!**/*"],
  "overrides": [
    {
      "files": ["*.ts"],
      "extends": [
        "plugin:@nx/angular",
        "plugin:@angular-eslint/template/process-inline-templates"
      ],
      "rules": {
        "@angular-eslint/directive-selector": [
          "error",
          {
            "type": "attribute",
            "prefix": "<%= projectName %>",
            "style": "camelCase"
          }
        ],
        "@angular-eslint/component-selector": [
          "error",
          {
            "type": "element",
            "prefix": "<%= projectName %>",
            "style": "kebab-case"
          }
        ]
      }
    },
    {
      "files": ["*.html"],
      "extends": ["plugin:@nx/angular-template"],
      "rules": {}
    }
  ]
}