File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
src/lib/schematics/utils/devkit-utils Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -82,17 +82,17 @@ function addDeclarationToNgModule(options: any): Rule {
82
82
} ;
83
83
}
84
84
85
-
86
- function buildSelector ( options : any ) {
85
+ function buildSelector ( options : any , projectPrefix : string ) {
87
86
let selector = strings . dasherize ( options . name ) ;
88
87
if ( options . prefix ) {
89
88
selector = `${ options . prefix } -${ selector } ` ;
89
+ } else if ( options . prefix === undefined && projectPrefix ) {
90
+ selector = `${ projectPrefix } -${ selector } ` ;
90
91
}
91
92
92
93
return selector ;
93
94
}
94
95
95
-
96
96
export function buildComponent ( options : any ) : Rule {
97
97
return ( host : Tree , context : SchematicContext ) => {
98
98
const workspace = getWorkspace ( host ) ;
@@ -105,7 +105,7 @@ export function buildComponent(options: any): Rule {
105
105
options . path = `/${ project . root } /src/app` ;
106
106
}
107
107
108
- options . selector = options . selector || buildSelector ( options ) ;
108
+ options . selector = options . selector || buildSelector ( options , project . prefix ) ;
109
109
options . module = findModuleFromOptions ( host , options ) ;
110
110
111
111
const parsedPath = parseName ( options . path , options . name ) ;
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ export interface Workspace {
49
49
export interface Project {
50
50
name : string ;
51
51
52
+ /** Application prefix. */
53
+ prefix : string ;
54
+
52
55
/** Project type. */
53
56
projectType : 'application' | 'library' ;
54
57
/** Root of the project sourcefiles. */
You can’t perform that action at this time.
0 commit comments