MapPage类型是2个模块的声明的一部分:PostParcelPageModule和PendingTransactionPageModule

时间:2019-06-14 10:34:13

标签: angular ionic4

我想在其他2个页面中使用此地图页面,但是会出现此问题

类型MapPage是2个模块的声明的一部分:PostParcelPageModule和PendingTransactionPageModule!请考虑将MapPage移至导入PostParcelPageModule和PendingTransactionPageModule的更高模块。您还可以创建一个新的NgModule,该导出并包含MapPage,然后在PostParcelPageModule和PendingTransactionPageModule中导入该NgModule。

map.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { GooglePlaceModule } from 'ngx-google-places-autocomplete';

import { IonicModule } from '@ionic/angular';

import { MapPage } from './map.page';

const routes: Routes = [
  {
    path: '',
    component: MapPage
  }
];

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    GooglePlaceModule,
    RouterModule.forChild(routes)
  ],
  declarations: [MapPage]
})
export class MapPageModule {}

pending-transaction.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { PendingTransactionPage } from './pending-transaction.page';
import { EditRequestPage } from '../edit-request/edit-request.page';

import { GooglePlaceModule } from 'ngx-google-places-autocomplete';
import { MapPage } from '../map/map.page';

const routes: Routes = [
  {
    path: '',
    component: PendingTransactionPage
  }
];

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    RouterModule.forChild(routes),
    ReactiveFormsModule,
    GooglePlaceModule
  ],
  declarations: [PendingTransactionPage,EditRequestPage,MapPage],
  entryComponents:[EditRequestPage,MapPage]
})
export class PendingTransactionPageModule {}

post-parcel.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';

import { IonicModule } from '@ionic/angular';
import { PostParcelPage } from './post-parcel.page';
import { MapPage } from '../map/map.page';
import { GooglePlaceModule } from 'ngx-google-places-autocomplete';

const routes: Routes = [
  {
    path: '',
    component: PostParcelPage
  }
];

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    RouterModule.forChild(routes),
    ReactiveFormsModule,
    GooglePlaceModule
  ],
  declarations: [PostParcelPage,MapPage],
  entryComponents:[MapPage]


})
export class PostParcelPageModule {}

0 个答案:

没有答案