README
Schematic to add a feature module to an application.
Usage
The package addresses the following usecaes
ng-add
schematics for feature modules
Implement the The modules exposes the addFeatureModuleToApplication
schematic that can be used as a general purpose implementation of the ng-add schematic. The implementation will add the ngModule of a feature module to the main application.
Use the following ng-generate schematic to add ng-add support to your feature module.
ng-add
schematics to a feature module
Add support for the For a feature module add the following command to add support for the ng-add schematic:
ng generate @acoustic-content-sdk/schematics-feature-module.schematics --module MODULE_NAME
Where MODULE_NAME
is the name of the module you'd like to have added.
The result of this command is the registration of an ng-add for the module, so the module can be added to another application via:
ng add YOUR_NPM_PACKAGE_NAME
Advanced Usecase
In case your module requires the inclusion of top level modules from external libraries you can add these modules using the syntax importPath#moduleName
where the import path points to the external module. Make sure to also add the imported module to the peerDependencies
of your module.
Example:
If your module contains animations you might want to add the BrowserAnimationsModule
module to the app, using this specifier: @angular/platform-browser/animations#BrowserAnimationsModule
.
Documentation
Home > @acoustic-content-sdk/schematics-feature-module
schematics-feature-module package
Schematic to add a feature module to an application.
Functions
Function | Description |
---|---|
addFeatureModuleToApplication(options) | Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.The command is modeled such that it can be referenced from a feature module without any additional coding involved. |
generateFeatureModuleSchematic(options) | Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.The command is modeled such that it can be referenced from a feature module without any additional coding involved. |
Interfaces
Interface | Description |
---|---|
AddFeatureModuleToApplicationSchema | Definition of the input parameters for the schematic |
GenerateFeatureModuleSchema |
Variables
Variable | Description |
---|---|
VERSION | Version and build number of the package |
Home > @acoustic-content-sdk/schematics-feature-module > addFeatureModuleToApplication
addFeatureModuleToApplication() function
Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.
The command is modeled such that it can be referenced from a feature module without any additional coding involved.
Signature:
export declare function addFeatureModuleToApplication(options: AddFeatureModuleToApplicationSchema): Rule;
Parameters
Parameter | Type | Description |
---|---|---|
options | AddFeatureModuleToApplicationSchema |
the schematics object used to describe the feature module |
Returns:
Rule
the schematics rule that executes the transform
Home > @acoustic-content-sdk/schematics-feature-module > generateFeatureModuleSchematic
generateFeatureModuleSchematic() function
Adds a feature module to an application. The feature module is defined as part of the input options. The schematics fill locate the correct application module and then imports the feature module into the application module.
The command is modeled such that it can be referenced from a feature module without any additional coding involved.
Signature:
export declare function generateFeatureModuleSchematic(options: GenerateFeatureModuleSchema): Rule;
Parameters
Parameter | Type | Description |
---|---|---|
options | GenerateFeatureModuleSchema |
the schematics object used to describe the feature module |
Returns:
Rule
the schematics rule that executes the transform
Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema
AddFeatureModuleToApplicationSchema interface
Definition of the input parameters for the schematic
Signature:
export interface AddFeatureModuleToApplicationSchema
Properties
Property | Type | Description |
---|---|---|
importPath | string |
Optionally the import path of the module. If missing defaults to the project running the initial schematic. |
module | string |
Name of the module, may be a comma separated list. Module identifiers have the following syntax: [path#]name[.forRoot()] . If path is missing it falls back to the import path given by this schema (or its default). |
project | string |
The project name, falls back to the default project |
Home > @acoustic-content-sdk/schematics-feature-module > GenerateFeatureModuleSchema
GenerateFeatureModuleSchema interface
Signature:
export interface GenerateFeatureModuleSchema
Properties
Property | Type | Description |
---|---|---|
module | string |
Name of the module, may be a comma separated list |
project | string |
The project name, falls back to the default project |
Home > @acoustic-content-sdk/schematics-feature-module > VERSION
VERSION variable
Version and build number of the package
Signature:
VERSION: {
version: {
major: string;
minor: string;
patch: string;
branch: string;
};
build: Date;
}
Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema > importPath
AddFeatureModuleToApplicationSchema.importPath property
Optionally the import path of the module. If missing defaults to the project running the initial schematic.
Signature:
importPath?: string;
Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema > module
AddFeatureModuleToApplicationSchema.module property
Name of the module, may be a comma separated list. Module identifiers have the following syntax: [path#]name[.forRoot()]
. If path
is missing it falls back to the import path given by this schema (or its default).
Signature:
module: string;
Home > @acoustic-content-sdk/schematics-feature-module > AddFeatureModuleToApplicationSchema > project
AddFeatureModuleToApplicationSchema.project property
The project name, falls back to the default project
Signature:
project?: string;
Home > @acoustic-content-sdk/schematics-feature-module > GenerateFeatureModuleSchema > module
GenerateFeatureModuleSchema.module property
Name of the module, may be a comma separated list
Signature:
module: string;
Home > @acoustic-content-sdk/schematics-feature-module > GenerateFeatureModuleSchema > project
GenerateFeatureModuleSchema.project property
The project name, falls back to the default project
Signature:
project?: string;