angular-module

Angular exported component from module not useable in another module

回眸只為那壹抹淺笑 提交于 2020-08-23 03:07:09
问题 I am exporting a custom component in my AppModule but can not use it in another module, which is being imported in the AppModule. I thought exported components are visible globally? I am trying to use the CalendarComponent with the selector 'app-calendar' in a component within the TestModule. app.module.ts @NgModule({ declarations: [ ... , CalendarComponent, ], imports: [ ... , TestModule, ], exports: [ ... CalendarComponent, ], providers: [ ... ], bootstrap: [AppComponent] }) test.module.ts

What is difference between `loadChildren: () => import('./hoge.module.ts).then(m => m.HogeModule)' and loadChildren: './hoge.module#HogeModule'?

早过忘川 提交于 2020-07-20 05:37:35
问题 Issue We get an error cannot find module in case following structure. app-routing.module.ts const routes: Routes = [ { path: CHILD_MANAGEMENT_PORTAL.baseUrl, canActivate: [AuthGuard], component: EnvelopeComponent, loadChildren: () => import('./features/child-management/child-management.module').then( m => m.ChildManagementModule ), data: { menuResolver: ChildManagementMenuResolver, pageTitleResolver: ChildManagementPageTitleResolver, portalData: CHILD_MANAGEMENT_PORTAL } }, ]; @NgModule({

Angular class is not an Angular module

三世轮回 提交于 2020-05-09 04:49:45
问题 When I build my Angular library, publish it to npm, and use it as a dependency in another project, whenever I try to import on of my module classes into my app.module.ts , and get this error Class TekButtonModule is not an Angular module . I have followed steps from multiple different sites on how to create, build, and publish angular libraries, and I can't figure out why it won't recognize the class as a valid module class. In my app.module.ts, this is how I am importing the module: import {

@Injectable() decorator and providers array

三世轮回 提交于 2020-03-21 06:50:11
问题 Does a service that is provided in "root" within the @Injectable() decorator still have to be in the providers array of the module? The Angular documentation doesn't really give me an answer or I don't quite understand it. Inside my core folder I have a authentication service which is provided in root. I wan't to import my core module inside the app module in order to use all the services and components provided. Do I have to additionally set up the service in the providers array of the

Angular lazy loaded module is loaded from wrong url

旧街凉风 提交于 2020-02-06 04:13:05
问题 In Angular I added a new admin module which is lazy loaded when the user visits the admin routes. { path: 'admin', loadChildren: './admin/admin.module#AdminModule', } The module is present in the dist folder but the browser can't resolve the module .js file because it is looking in the wrong place. The module is build by angular as of the build log: chunk {admin-admin-module} admin-admin-module.js, admin-admin-module.js.map (admin-admin-module) 293 kB [rendered] All build files ( main.js ,

Angular 5, using a component in a sub-module

北慕城南 提交于 2020-01-24 13:52:26
问题 I am getting an error I cannot seem to remedy, when I sub-divided my app for lazy loading efficiencies and and using a sub-router for "child" , I need to use a component that is used in the main app. But I am getting This below error message Type AccountInfoComponent is part of the declarations of 2 modules My app structure looks like this app |--components |--accountInfo |--accountInfo.component.ts |--user |--user.component.ts |--modules |--child |--child.component.ts |--child.module.ts |-

Load ngModule and its components based on conditional in Angular

偶尔善良 提交于 2020-01-20 06:58:25
问题 I'm new in angular and I was wondering if it's possible to load and module and its components I made based on a conditional on the app.module or where would it be the best place to do this. Basically I want to do something like: if(user.deparment === 'coms') { //Use the communications.module and its components } I have attached some picture so you guys can see the structure of the app. if necessary I can add the code instead of a picture. App.module picture Communications.module picture 回答1:

How does one go about creating an Angular library wrapper for an existing Javascript library?

有些话、适合烂在心里 提交于 2020-01-12 13:04:26
问题 Suppose there exists a Javascript library written in plain Javascript and commonly used on vanilla, non-frameworked websites. How does one go about creating an Angular library that can easily be npm install ed that would make the library seamless to use in an Angular app? I cannot find any good demonstrations of this process in the Angular docs or on the wider web. Just for instance, there is a fantastic Javascript library called p5.js , which is not straightforward to use with Angular. How

Angular 5 with materialize css

﹥>﹥吖頭↗ 提交于 2020-01-05 07:40:11
问题 I'm learning angular 5. but I was following this tutorial to import materialize css module to my app. Ang with angular2materialize then I run ng serve and it compiled successfully. but when I load the content it return an error Uncaught Error: Couldn't find Materialize object on window. It is created by the materialize-css library. Please import materialize-css before importing angular2-materialize. how should I proceed? 回答1: Use import 'materialize-css'; before import {MaterializeModule}

How should I include model classes in an Angular module?

风流意气都作罢 提交于 2020-01-02 02:34:05
问题 I've a few classes I want to be just a plain bean/DTO class, they aren't display @component classes, they're not @Pipe classes nor should they be @Directive (at least I don't think it should be!). I want to be able to bundle them into a module (they will be used across other modules), but despite several incantations I keep getting errors like this: When I startup my Angular app (ng serve) it compiles ok, but in the browser (Chrome) console I get an error.... Uncaught Error: Unexpected value