2016-07-14 6 views
4

他のアプリケーションからアプリケーションのコンポーネントを使用しようとしています。私のプロジェクトは同じフォルダにありますので、うまくいくと思っていましたが、「モジュールが見つかりません」という例外が出ています。 これを行う方法はありますか?これを達成するための別の方法ですか? systemConfigでAngular2-別のアプリケーションのコンポーネントを使用する

import { Component, OnInit } from '@angular/core'; 
import { OverviewPaginationComponent } from './../../../../overview/src/app/overview-pagination/overview-pagination.component.ts'; 

@Component({ 
    moduleId: module.id, 
    selector: 'combi', 
    template: ` 
<overview-pagination><overview-pagination> 

`, 
    styleUrls: ['combi.component.css'], 
    providers: [], 
    directives: [OverviewPaginationComponent] 
}) 
export class CombiComponent implements OnInit { 

    constructor() {} 

    ngOnInit() { 
    } 

} 

と定義される:

const barrels: string[] = [ 
    // Angular specific barrels. 
    '@angular/core', 
    '@angular/common', 
    '@angular/compiler', 
    '@angular/forms', 
    '@angular/http', 
    '@angular/router', 
    '@angular/platform-browser', 
    '@angular/platform-browser-dynamic', 
    '@angular/router-deprecated', 

    // Thirdparty barrels. 
    'rxjs', 

    // App specific barrels. 
    'app', 
    'app/shared', 
    'app/combi', 
    '../../overview/src/app/overview-pagination', 
    /** @cli-barrel */ 
]; 

答えて

0

あなたはその「機能」どこの親モジュールを使用しようとしているコンポーネントを追加する必要があります私はこれまでのところで何をしたか

あなたはそのコンポーネントを使うつもりです。たとえば、このモジュールが、OverviewPaginationComponentを使用しようとしている親モジュールであるとします。

import { BrowserModule } from '@angular/platform-browser'; 
import { NgModule } from '@angular/core'; 

import { AppRoutingModule } from './app-routing.module'; 
import { AppComponent } from './app.component'; 
import { OverviewPaginationComponent } from 'path'; 


@NgModule({ 
    declarations: [ 
    AppComponent, 
    OverviewPaginationComponent 
    ], 
    imports: [ 
    BrowserModule, 
    AppRoutingModule 
    ], 
    providers: [], 
    bootstrap: [AppComponent] 
}) 
export class AppModule { } 
関連する問題