Please suggest alternative way to generate angular components.
Just create a new file, and start typing.
The CLI's g (generate) methods are simple scaffolders for components, which generate some files for you in a folder which you specify, and edit some other files. This is not a requirement for a project using CLI: you can create files yourself.
For example, generating a component will
- create a folder in the path you specify with the component's name
- create a file in the folder named
{{component-name}}.component.ts with a class skeleton which has pre-filled metadata inside the @Component decorator, a constructor and implementation of the OnInit lifecycle hook,
- create an empty file in the folder named
{{component-name}}.component.css, or a different extension based on your settings in the .angular-cli.json file,
- create a very simple
{{component-name}}.component.html file which just states that your component is working,
- create a scaffolded test file
{{component-name}}.component.spec.ts which tests for creation of a component, and
-- add the component in the declarations array of the corresponding Angular module.
All of this is something you can do yourself, if you want to. For example, I do not use the CLI's g command when I'm creating very simple component, because I do not use separate files for the templates and the styles.
By the way, the fact that you're using ASP as your back-end should not interfere with how you manage your front-end application. Angular is a framework for building single-page applications which means that your backend be an API separate from the Angular application which will only serve as a client.
As for why you're getting the error -- are you trying to do an ng g command in a project which was not ng newd?
The other possible source of the error is that you're trying to create it in the folder which is not an Angular module. To get there, just navigate through your structure.
ng g component a/path/to/login-module/login-form