angular-module

Custom RouteReuseStrategy for Angular's child module

青春壹個敷衍的年華 提交于 2019-11-27 15:21:48
问题 I want to use this custom route reuse strategy for just one module: export class CustomRouteReuseStrategy extends RouteReuseStrategy { public shouldDetach(route: ActivatedRouteSnapshot): boolean { return false; } public store(route: ActivatedRouteSnapshot, detachedTree: DetachedRouteHandle): void {} public shouldAttach(route: ActivatedRouteSnapshot): boolean { return false; } public retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle { return null; } public shouldReuseRoute(future:

Loading modules from different server at runtime

五迷三道 提交于 2019-11-27 14:09:06
问题 Is it somehow possible to load different modules in my angular 2 app runtime, from different servers and if so, how can I achieve this? I would like to have my app load different components from the overall application from isolated servers (A, B, C), so they can be taken down and updated independently from the main app and any components which are included in A, B or C won't be loaded. The 3 modules shown on the bottom would have the Components, but the Main App would declare in it's HTML

What is the difference between declarations, providers, and import in NgModule?

…衆ロ難τιáo~ 提交于 2019-11-27 09:56:01
I am trying to understand Angular (sometimes called Angular2+), then I came across @Module : Imports Declarations Providers Following Angular Quick Start Günter Zöchbauer Angular Concepts imports makes the exported declarations of other modules available in the current module declarations are to make directives (including components and pipes) from the current module available to other directives in the current module. Selectors of directives, components or pipes are only matched against the HTML if they are declared or imported. providers are to make services and values known to DI

Angular 2 'component' is not a known element

ぐ巨炮叔叔 提交于 2019-11-26 15:21:54
问题 I'm trying to use a component I created inside the AppModule in other modules. I get the following error though: "Uncaught (in promise): Error: Template parse errors: 'contacts-box' is not a known element: If 'contacts-box' is an Angular component, then verify that it is part of this module. If 'contacts-box' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. My project structure is quite simple: I keep my pages in pages

What is the difference between declarations, providers, and import in NgModule?

白昼怎懂夜的黑 提交于 2019-11-26 14:57:29
问题 I am trying to understand Angular (sometimes called Angular2+), then I came across @Module : Imports Declarations Providers Following Angular Quick Start 回答1: Angular Concepts imports makes the exported declarations of other modules available in the current module declarations are to make directives (including components and pipes) from the current module available to other directives in the current module. Selectors of directives, components or pipes are only matched against the HTML if they

Angular 2 Use component from another module

≯℡__Kan透↙ 提交于 2019-11-26 03:28:53
I have Angular 2 (version 2.0.0 - final) app generated with angular-cli. When I create a component and add it to AppModule 's declarations array it's all good, it works. I decided to separate the components, so I created a TaskModule and a component TaskCard . Now I want to use the TaskCard in one of the components of the AppModule (the Board component). AppModule: import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { AppComponent } from './app

Angular Use component from another module

坚强是说给别人听的谎言 提交于 2019-11-26 01:48:57
问题 I have Angular 2 (version 2.0.0 - final) app generated with angular-cli. When I create a component and add it to AppModule \'s declarations array it\'s all good, it works. I decided to separate the components, so I created a TaskModule and a component TaskCard . Now I want to use the TaskCard in one of the components of the AppModule (the Board component). AppModule: import { BrowserModule } from \'@angular/platform-browser\'; import { NgModule } from \'@angular/core\'; import { FormsModule }