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"
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"
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.
The option --module is not available for a service : https://angular.io/cli/generate#service
But its available for a componant : https://angular.io/cli/generate#component