File tree Expand file tree Collapse file tree
packages/angular-cli/blueprints Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,8 +85,10 @@ module.exports = {
8585 const returns = [ ] ;
8686 const className = stringUtils . classify ( `${ options . entity . name } Directive` ) ;
8787 const fileName = stringUtils . dasherize ( `${ options . entity . name } .directive` ) ;
88- const componentDir = path . relative ( this . dynamicPath . appRoot , this . generatePath ) ;
89- const importPath = componentDir ? `./${ componentDir } /${ fileName } ` : `./${ fileName } ` ;
88+ const fullGeneratePath = path . join ( this . project . root , this . generatePath ) ;
89+ const moduleDir = path . parse ( this . pathToModule ) . dir ;
90+ const relativeDir = path . relative ( moduleDir , fullGeneratePath ) ;
91+ const importPath = relativeDir ? `./${ relativeDir } /${ fileName } ` : `./${ fileName } ` ;
9092
9193 if ( ! options [ 'skip-import' ] ) {
9294 returns . push (
Original file line number Diff line number Diff line change @@ -73,8 +73,10 @@ module.exports = {
7373 const returns = [ ] ;
7474 const className = stringUtils . classify ( `${ options . entity . name } Pipe` ) ;
7575 const fileName = stringUtils . dasherize ( `${ options . entity . name } .pipe` ) ;
76- const componentDir = path . relative ( this . dynamicPath . appRoot , this . generatePath ) ;
77- const importPath = componentDir ? `./${ componentDir } /${ fileName } ` : `./${ fileName } ` ;
76+ const fullGeneratePath = path . join ( this . project . root , this . generatePath ) ;
77+ const moduleDir = path . parse ( this . pathToModule ) . dir ;
78+ const relativeDir = path . relative ( moduleDir , fullGeneratePath ) ;
79+ const importPath = relativeDir ? `./${ relativeDir } /${ fileName } ` : `./${ fileName } ` ;
7880
7981 if ( ! options [ 'skip-import' ] ) {
8082 returns . push (
You can’t perform that action at this time.
0 commit comments