Skip to content

Instantly share code, notes, and snippets.

@Alvaro237
Created February 6, 2022 11:20
Show Gist options
  • Select an option

  • Save Alvaro237/13b6cda6d5849772d57cc85ea6f5d31c to your computer and use it in GitHub Desktop.

Select an option

Save Alvaro237/13b6cda6d5849772d57cc85ea6f5d31c to your computer and use it in GitHub Desktop.
Angular #CoreModule
No es necesario exportar nada, sirve para mantener app.module.ts más limpio, solo cuando se necesite ya que la mejor forma es en cada servicio usar providedIn root por ejemplo
import { NgModule } from '@angular/core';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { ShoppingListService } from './shopping-list/shopping-list.service';
import { RecipeService } from './recipes/recipe.service';
import { AuthInterceptorService } from './auth/auth-interceptor.service';
import { LoggingService } from './logging.service';
@NgModule({
providers: [
ShoppingListService,
RecipeService,
{
provide: HTTP_INTERCEPTORS,
useClass: AuthInterceptorService,
multi: true
}
]
})
export class CoreModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment