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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.