angular2-modules

Importing angular component to be available in all modules

血红的双手。 提交于 2019-12-10 22:35:37
问题 I've recently started playing with angular 2 and my experience so far is awesome. I have some good experience with ng1 and React as well. So, this is more of a general question and a confusion as well. I am pretty sure this would help out a lot of other people as well as I haven't really found any direct answer to this. So let's say I have this module protected.module.ts where I have some components registered. So, in order to use primitive directives ngFor, ngIf I would have to import

Inherit imports from parent module to child module in Angular2

馋奶兔 提交于 2019-12-08 16:15:31
问题 I made an Angular2 app like described here. It has two components (A,B) which are imported by the global app.module . My idea was, to include shared modules in app.module , so I don't need to mess up every module with redundant code. I want to do that for example with the FormsModule . So in the app.module I have imports: [ UniversalModule, CommonModule, FormsModule, AModule RouterModule.forRoot([]) ], exports: [FormsModule] But in the A module I got the exception Can't bind to 'ngModel'

Angular 2: Module not found: Error: Can't resolve

拥有回忆 提交于 2019-12-06 18:55:49
问题 I have a simple app created with Angular-CLI, I wanted to refactor and move the app.component.ts code in separate component file and started to get a nasty error: Module not found: Error: Can't resolve on './sb/sb.component.html' ( my SBComponent). Under the This what i have: app.module: import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import {

Having trouble exporting from an Angular2 module

£可爱£侵袭症+ 提交于 2019-12-06 08:20:19
I'm a beginner with Angular 2, and am trying to understand how to export a class from a feature module, and import it into my main module. When I try to compile this in typescript, I receive the following two errors: app/app.component.ts(11,21): error TS2304: Cannot find name 'AddService'. app/app.module.ts(4,9): error TS2305: Module '"C:/angular/app/add/arithmetic.module"' has no exported member 'AddService'. my tree is simple: / index.html package.json systemjs.config.js tsconfig.json typings.json app/ app.component.html app.component.ts app.module.ts main.ts add/ add.service.ts arithmetic

Angular 2 global component

蹲街弑〆低调 提交于 2019-12-06 07:31:53
My structure is as follows : App *component, module, template* Component 1 *component, module, template* Component 11 *component, module, template* Global Component *component, temaplte, BUT NO MODULE* My App module contains the component 1 and component 11 modules. I declared the global component in the app module, so that I can use it in all my other components. I also exported it in app module. But when I use the selector in the component 11 template, the console says not a known element . I tried importing it in my other components but it says it's already imported, and that I should

Angular 2: Module not found: Error: Can't resolve

别说谁变了你拦得住时间么 提交于 2019-12-05 01:12:35
I have a simple app created with Angular-CLI, I wanted to refactor and move the app.component.ts code in separate component file and started to get a nasty error: Module not found: Error: Can't resolve on './sb/sb.component.html' ( my SBComponent). Under the This what i have: app.module: 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.component'; import { SBComponent } from './sb/sb.component' @NgModule({ declarations

Angular2 - 'Can't resolve all parameters' error while injecting http into a custom service

删除回忆录丶 提交于 2019-12-03 14:40:48
问题 I have built an ErrorHandlerLogger which is a service which extends ErrorHandler and logs error messages into a remote repository. ErrorHandlerLogger requires the Angular http client provided by the HttpModule . In the ErrorHandlerModule I import HttpModule and define ErrorHandlerLogger as provider. In the AppModule I import ErrorHandlerModule . When I launch the app I get the following error message Uncaught Error: Can't resolve all parameters for ErrorHandlerLogger: (?). Here my code

How to dynamically load external angular 2 module (like served from an external module.bundle.js)

◇◆丶佛笑我妖孽 提交于 2019-12-03 12:41:00
问题 I can dynamically load local modules as someone else did in the plunker here. But how do I load an external module, lets say from a separate bundle js served by another service. In the example plunker, src/app.ts has: constructor(private viewref: ViewContainerRef, private resolver: ComponentFactoryResolver, private loader: SystemJsNgModuleLoader, private compiler: Compiler){ this.module = new ModuleNode(); //can I make this a non-local script reference somehow? //like to http://example.net

Unexpected value 'MyCustomModule' imported by the module 'AppModule'

风流意气都作罢 提交于 2019-12-03 10:45:52
问题 I am trying to migrate one of my angular2 custom library to RC.6 + Webpack. My directory structure is: - src - source TS files - lib - transpiled JS files + definition files - dev - development app to test if it works / looks ok. - myCustomLib.js - barrel - myCustomLib.d.ts Within dev folder try to run an app. I bootstrap my module: app.module.ts import { BrowserModule } from "@angular/platform-browser"; import { NgModule } from "@angular/core"; import { AppComponent } from "./app.component";

Angular2 - 'Can't resolve all parameters' error while injecting http into a custom service

坚强是说给别人听的谎言 提交于 2019-12-03 04:27:29
I have built an ErrorHandlerLogger which is a service which extends ErrorHandler and logs error messages into a remote repository. ErrorHandlerLogger requires the Angular http client provided by the HttpModule . In the ErrorHandlerModule I import HttpModule and define ErrorHandlerLogger as provider. In the AppModule I import ErrorHandlerModule . When I launch the app I get the following error message Uncaught Error: Can't resolve all parameters for ErrorHandlerLogger: (?). Here my code ErrorHandlerModule import { NgModule, ErrorHandler } from '@angular/core'; import { HttpModule } from '