Injecting service to a specified module in angular 6+

When a new service is created using angular-cli, the service is injected at the root level using @Injectable decorator.

@Injectable({
  providedIn: 'root',
})
export class HeroService {
  constructor() { }
}

But I don’t want the service at the root level, I want it only in a specified module.
Before ng6, this can be achieved by adding he serves only to the providers array of the specified module.
is this still the right way in ng6+

Source: New feed
Source Url Injecting service to a specified module in angular 6+