With Angular 6, below is the preferred way to create singleton services:
import { Injectable } from \'@angular/core\';
@Injectable({
providedIn: \'root\',
})
I think creating a core module became obsolete since a service can define itself to be registered to root via providedIn: root
The (old!) angular style guide recommended to create a core module till v6: https://v6.angular.io/guide/styleguide
But since v7 there is no recommendation anymore to create a core module.
I think it is exactly for that reason (providedIn: root
does the job).