ng-modules

Angular - using forRoot({}) config in loadChildren() to configure a lazy-loaded module

荒凉一梦 提交于 2021-01-01 02:16:25
问题 I want to have a loaded module configurable. In theory, I want a module that is its own bigger application do receive some configuration. To show / load certain elements depending on the config the main application sends down. I used that with other modules but those where not lazyLoaded. I tried and searched around and have not seen the usage of something like: children: [ { path: 'application-module', loadChildren: () => import('@application-module').then(m => m.ApplicationModule.forRoot({

module declares component locally, but it is not exported

徘徊边缘 提交于 2020-06-17 14:39:08
问题 i have created a shared module and declared & exported the component i need in other modules. import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { DateslideComponent } from './dateslide/dateslide.component'; import { IonicModule } from '@ionic/angular'; import { TimeslideComponent } from './timeslide/timeslide.component'; import { AddtimeComponent } from './addtime/addtime.component' @NgModule({ declarations: [DateslideComponent,

Angular aot build: dynamic forRoot parameter results in undefined

杀马特。学长 韩版系。学妹 提交于 2020-05-13 07:03:20
问题 I need to send a configuration (array of objects) to a service in a feature module and this configuration needs to be dynamically calculated. I used forRoot and it worked fine until I've built it with --aot . problem: With --aot , the configuration results in undefined . Here is a link to an example I made on stackblitz: https://stackblitz.com/edit/angular-aot-forroot-error !! it works as desired on stackblitz, since it is not built with aot !! If you build it locally with aot, though, the

Angular aot build: dynamic forRoot parameter results in undefined

不想你离开。 提交于 2020-05-13 07:02:15
问题 I need to send a configuration (array of objects) to a service in a feature module and this configuration needs to be dynamically calculated. I used forRoot and it worked fine until I've built it with --aot . problem: With --aot , the configuration results in undefined . Here is a link to an example I made on stackblitz: https://stackblitz.com/edit/angular-aot-forroot-error !! it works as desired on stackblitz, since it is not built with aot !! If you build it locally with aot, though, the

One single NgModule versus multiples ones with Angular 2

元气小坏坏 提交于 2019-12-12 11:24:04
问题 I'm wondering if it's better to create one single module that contains all my angular 2 code or if it is better to split everything across multiple modules. For example, I'm creating my blog with Angular 2. So I have a "article-list" component and an "article" one. "article-list" calls a service that returns a list of articles then do a "ngFor" on it and inserts an "article" for each one. The "article" component contains a "tag-list" component (that follows the same pattern as the "article

Unable to change or give custom CSS for ng-datepicker

流过昼夜 提交于 2019-12-11 06:35:11
问题 I am trying to give custom CSS for bs-datepicker. But, its not accepting any change from component.css. I tried adding a class name in the node file of bs-datepicker in node_modules and making css changes using that class name, but the changes are not reflecting when I build the application using ng-build. Whatever change I make in node modules, they are reflecting in ng serve local view, but in ng-build , no changes are reflecting.The image of bs-datepicker is attached here I want to change

Angular2 - “Can't bind to 'ngSwitchWhen' since it isn't a known property of 'template'.”

落花浮王杯 提交于 2019-12-10 05:31:47
问题 I am getting the following error "Can't bind to 'ngSwitchWhen' since it isn't a known property of 'template'." I've read different topics where it was advised to add import { CommonModule } from '@angular/common' and add "CommonModule" into the imports section of @NgModel, which I did, however this did not solve the problem. I can't figure out what I'm doing wrong, any help in how to fix this? This is my code for "app.component.ts" import { Component } from '@angular/core' @Component({

How to correctly import FormGroup in NgModule in Angular 2

丶灬走出姿态 提交于 2019-12-09 07:59:23
问题 I try to import FromGroup , FormBuilder and FormControl to my CustomModule : import { FormsModule, FormGroup } from '@angular/forms'; @NgModule({ imports: [ FormsModule, FormGroup ] }) But it throws an error: EXCEPTION: Uncaught (in promise): Error: Unexpected value 'FormGroup' imported by the module 'CustomModule' If i only import FormsModule it works fine though. Any ideas? 回答1: You can't add FormGroup to module's imports, just import it in the component in which you want to use FormGroup .

Add Models/Entities/Objects to NgModule in Angular 2

匆匆过客 提交于 2019-12-08 18:23:54
问题 I've been trying to create an @NgModule (named ModelsModule ) made of objects like User, Book, Library, Movie, and so on. Doing this I'm trying to not to import every object every time I need it but importing them at the beginning in the AppModule (main @NgModule) and use them as many times I want. Objects/Entities/Classes... example export class Author { constructor ( public name: string, public avatar: string ) { } } ModelsModule import { NgModule } from '@angular/core'; import {