Code Monkey home page Code Monkey logo

Comments (2)

probert94 avatar probert94 commented on June 1, 2024

I just tested how this works and it seems like you must specify the path to the module file.
For example:
ng generate directive test --module ../app.module.ts

This allowes you to create a file in any directory and instead of declaring it in the nearest module, you can declare it in any module.

I have tested following cases:

  • Specify a non-existing file -> Command fails, no files generated/changed
  • Specify a file without @NgModule annotation -> Files are generated, but not added to any module
  • Specify a file with more then one @NgModule annotation -> Files generated and declaration added to last @NgModule in specified file

@angelozerr I guess this feature won't be needed verry often, as you usually want declarations to go into the nearest @NgModule.
But if we want to support this, a basic support with a file-chooser could be implemented pretty fast and would be enough for now.
Later we could extend it to show only files, which contain at least 1 @NgModule-annotation.

from angular-eclipse.

angelozerr avatar angelozerr commented on June 1, 2024

To be honnest with you, I don't know @NgModule, so I trust you! Any PR are welcome, thanks!

from angular-eclipse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.