每当我尝试使用ionic3构建时,它都会出现“自定义组件错误”

时间:2018-05-28 12:06:51

标签: typescript ionic3 angular5

我正在使用 ionic3 并希望进行生产构建,我还使用命令行创建自定义组件。

但是每当我要进行构建时,它都会出现自定义组件错误,我还附加了一个图像并粘贴了我得到的错误的blockquote。 Image of the errors which I got

  

ngc开始......      打字稿错误               无法绑定到'control',因为它不是'control-messages'的已知属性。 1.如果'控制消息'是               一个Angular组件,它有'control'输入,然后验证它是否是该模块的一部分。如果               'control-messages'是一个Web组件,然后将'CUSTOM_ELEMENTS_SCHEMA'添加到'@ NgModule.schemas'中               组件来抑制此消息。 3.要允许任何属性添加'NO_ERRORS_SCHEMA'               这个组件的'@ NgModule.schemas'。 (”               ] [控制] = “userForm.controls.fname” >

这是我的component.module.ts代码

import { NgModule } from '@angular/core';
import { IonicModule } from 'ionic-angular';
import { ControlMessageComponent } from './control-message/control-message';
@NgModule({
	imports: [IonicModule],
	declarations: [ControlMessageComponent],
	exports: [ControlMessageComponent]
})
export class ComponentsModule {}

,这是我的App.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { BundlesAssortedPage } from '../pages/bundles-assorted/bundles-assorted';
import { AllCategoriesPage } from '../pages/all-categories/all-categories';
import { MyCartPage } from '../pages/my-cart/my-cart';
import { CheckoutPage } from '../pages/checkout/checkout';
import { CategoryDetailPage } from '../pages/category-detail/category-detail';
import { MyAddressesPage } from '../pages/my-addresses/my-addresses';
import { AddRemovePopoverPage } from '../pages/add-remove-popover/add-remove-popover';
import { OrderHistoryPage } from '../pages/order-history/order-history';
import { ReOrderDetailsPage } from '../pages/re-order-details/re-order-details';
import { OurLocationPage } from '../pages/our-location/our-location';
import { MyFavouritesPage } from '../pages/my-favourites/my-favourites';
import { SignupPage } from '../pages/signup/signup';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { ServicesProvider } from '../providers/services/services';
import { LoginPage } from '../pages/login/login';
import { ProductWizardPage } from '../pages/product-wizard/product-wizard';
import { ForgotPasswordPage } from '../pages/forgot-password/forgot-password';
import { AccountVerificationPage } from '../pages/account-verification/account-verification';
import { NetworkProvider } from '../providers/network/network';
import { Network } from '@ionic-native/network';
import { ProductDetailsPage } from '../pages/product-details/product-details';
import { AddAddressPage } from '../pages/modal/add-address/add-address';
import { GlobalStringsProvider } from '../providers/global-strings/global-strings';
import { OrderReviewPage } from '../pages/order-review/order-review';
import { OrderThankyouPage } from '../pages/order-thankyou/order-thankyou';
import { ValidationService } from '../providers/services/validation-service';
import { ControlMessageComponent } from '../components/control-message/control-message';
import { ionicComponents } from '../providers/ionic-components/ionic-components';
import { DesignPizzaPage } from '../pages/design-pizza/design-pizza';
import {  Connectivity } from '../providers/connectivity-service/connectivity-service';
import { Geolocation } from '@ionic-native/geolocation';
import { StoreInfoModalPage } from '../pages/store-info-modal/store-info-modal';
import { AccountSettingsPage } from '../pages/account-settings/account-settings';
import { ComboDetailsPage } from '../pages/combo-details/combo-details';
import { PhoneVerificationPage } from '../pages/phone-verification/phone-verification';

@NgModule({
  declarations: [
    MyApp,
    // HomePage,
    // BundlesAssortedPage,
    // ComboDetailsPage,
    // StoreInfoModalPage,
    // AllCategoriesPage,
    // ProductWizardPage,
    // CategoryDetailPage,
    // ProductDetailsPage,
    // MyCartPage,
    // DesignPizzaPage,
    // CheckoutPage,
    // OrderReviewPage,
    // OrderThankyouPage,
    // AddAddressPage,
    // MyAddressesPage,
    // AddRemovePopoverPage,
    // OrderHistoryPage,
    // ReOrderDetailsPage,
    // OurLocationPage,
    // MyFavouritesPage,
    // AccountSettingsPage,
    // LoginPage,
    // SignupPage,
    // PhoneVerificationPage,
    // ForgotPasswordPage,
    // AccountVerificationPage
  ],
  imports: [
    BrowserModule,
    ReactiveFormsModule,
    HttpClientModule,
    IonicModule.forRoot(MyApp),
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    // HomePage,
    // BundlesAssortedPage,
    // ComboDetailsPage,
    // StoreInfoModalPage,
    // AllCategoriesPage,
    // ProductWizardPage,
    // CategoryDetailPage,
    // ProductDetailsPage,
    // MyCartPage,
    // DesignPizzaPage,
    // CheckoutPage,
    // OrderReviewPage,
    // OrderThankyouPage,
    // AddAddressPage,
    // AddRemovePopoverPage,
    // MyAddressesPage,
    // AddRemovePopoverPage,
    // OrderHistoryPage,
    // ReOrderDetailsPage,
    // OurLocationPage,
    // MyFavouritesPage,
    // AccountSettingsPage,
    // LoginPage,
    // SignupPage,
    // PhoneVerificationPage,
    // ForgotPasswordPage,
    // AccountVerificationPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    ValidationService,
    ionicComponents,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    ServicesProvider,
    Network,
    NetworkProvider,
    GlobalStringsProvider,
    Connectivity,
    Geolocation
    
  ]
})
export class AppModule {}

如果有人可以帮助我,那真的很有用 亲切的问候

1 个答案:

答案 0 :(得分:0)

好吧,让我们听听您的错误并将CUSTOM_ELEMENTS_SCHEMA添加到您的 NgModule,因此请将其放在app.module.ts

import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';

@NgModule({
  schemas: [
     CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA
   ],
  declarations: [
    MyApp,
  ],
  imports: [
    BrowserModule,
    ReactiveFormsModule,
    HttpClientModule,
    IonicModule.forRoot(MyApp),
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp
  ],
  providers: [
    StatusBar,
    SplashScreen,
    ValidationService,
    ionicComponents,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    ServicesProvider,
    Network,
    NetworkProvider,
    GlobalStringsProvider,
    Connectivity,
    Geolocation

  ]
})
export class AppModule {}