The Angular CLI generates Services using a simple command. After your Service is generated, you can easily provide and share it to the rest of your application using Angular 2's Dependency Injection. This lesson walks through creating a Service with the Angular CLI then providing it to your application module.
I'm getting an error "main.ts:12Uncaught Error: Module build failed: Error:..." after editing 'providers: [MailService],' at app.module.ts, and it didn't automatically imported for me. How can I fix it ?
How comes that when generating a service, ng puts the files right in the app root folder? And creating a component showed that it gets generated inside its own folder. Are there guiding lines for this that ng is following?
message needs a type of string in mail.service or you get a type error.
message : string =
You've got mail!;
Not working
Had to change the private to public on app.component.ts in order to the example fully work. Its propably related to Aot on angular 8. https://stackoverflow.com/questions/45520838/identifier-refers-to-a-private-member-of-the-component
public message = 'You got mail';