angular-module

Angular: add a multi provider from lazy feature module

会有一股神秘感。 提交于 2021-02-19 03:22:42
问题 I have an ErrorModule (eager) configured as follows: export const CONFIG = new InjectionToken<ErrorConfig[]>('Module errors configuration.'); @NgModule({ imports: [... ] }) export class ErrorModule { static forRoot(config: ErrorConfig): ModuleWithProviders { return { ngModule: ErrorModule, providers: [ ErrorService, { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true }, { provide: CONFIG, useValue: config, multi: true } ] }; } static forChild(config: ErrorConfig):

Angular - export fontawesome to a feature module

寵の児 提交于 2021-02-11 15:16:35
问题 In app.module I got the following lines regarding fontawesome import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome'; import { faBars, faCopyright } from '@fortawesome/free-solid-svg-icons'; export class AppModule { constructor(private library: FaIconLibrary) { library.addIcons(faBars, faCopyright); } how can i include them in a feature module? the costructor part is troubling me 回答1: Icon library is provided using root scope, so you'll always have a single icon

Yet another “Can't bind to 'ngIf'”

懵懂的女人 提交于 2021-02-08 05:17:10
问题 I've looked at dozens of posts here and elsewhere with the same error message, plus the entire modules FAQ, but still haven't found a solution that works in my case. (E.g., questions 35543028, 35939950, 40426432, 40828068, 44898901, 45436552, 47660922, 50200329, 59212318...) They pointed out these things to check: Correct capitalization of ngIf: check The main module imports BrowserModule: check The module that creates the component imports CommonModule: N/A; the component comes from the main

Yet another “Can't bind to 'ngIf'”

≯℡__Kan透↙ 提交于 2021-02-08 05:15:30
问题 I've looked at dozens of posts here and elsewhere with the same error message, plus the entire modules FAQ, but still haven't found a solution that works in my case. (E.g., questions 35543028, 35939950, 40426432, 40828068, 44898901, 45436552, 47660922, 50200329, 59212318...) They pointed out these things to check: Correct capitalization of ngIf: check The main module imports BrowserModule: check The module that creates the component imports CommonModule: N/A; the component comes from the main

How to import all Angular Material modules in Angular 9

梦想与她 提交于 2021-01-02 07:51:57
问题 I want to import all angular material modules and use into overall angular project templates. 回答1: We can create a new module and import all material modules in the new module and use into our templates. Please use this command and run into Angular CLI: ng g m material --module=app --module=app - this command will automatically import newly created MaterialModule module and add into AppModule imports[] array. Now open MaterialModule file and Ctrl + C / Ctrl + P : import { NgModule } from '

How to import all Angular Material modules in Angular 9

狂风中的少年 提交于 2021-01-02 07:50:03
问题 I want to import all angular material modules and use into overall angular project templates. 回答1: We can create a new module and import all material modules in the new module and use into our templates. Please use this command and run into Angular CLI: ng g m material --module=app --module=app - this command will automatically import newly created MaterialModule module and add into AppModule imports[] array. Now open MaterialModule file and Ctrl + C / Ctrl + P : import { NgModule } from '

When to use Angular Directives, Components & Modules

天大地大妈咪最大 提交于 2020-11-28 19:47:50
问题 I've been reading the documentation but still seem to be confused on when you should use a directive or a component... Also, when is it best to abstract components and place them into modules?? 回答1: In fact, a component is also a type of directive according to the angular docs. There are three kinds of directives in Angular: 1. Components—directives with a template. 2. Structural directives—change the DOM layout by adding and removing DOM elements. 3. Attribute directives—change the