Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown option -m in angular cli

Tags:

angular

I want to create service and register it with app.module, but when I run this command

ng g s bram -m=app.module

I get an error:

Unknown option: "-m"

enter image description here

like image 655
Kumar Shubham Avatar asked Aug 16 '19 04:08

Kumar Shubham


People also ask

What is Sourcemap in angular JSON?

At its core, a source map is a JSON file that contains all the necessary information to map the transpiled code back to the original sources. Pretty cool! Technically a source map is just a JSON file that contains the following fields: version: indicates the source map spec version.

What is the angular JSON file?

The angular. json file at the root level of an Angular workspace provides workspace-wide and project-specific configuration defaults. These are used for build and development tools provided by the Angular CLI. Path values given in the configuration are relative to the root workspace directory.

What is Ng serve -- open?

ng serve is a great command to use when developing your application locally. It starts up a local development server, which will serve your application while you are developing it. It is not meant to be used for a production environment.


1 Answers

Generate service doesn’t take a module argument as services don’t really “belong” to a module. To provide in root just open your service and put

@Injectable({
  providedIn: ‘root’
})

Here are the docs for service. As you can see, service does not take a module argument.

like image 99
bryan60 Avatar answered Sep 29 '22 22:09

bryan60