【问题标题】:Nativescript custom dialog exceptionNativescript 自定义对话框异常
【发布时间】:2016-10-07 23:17:15
【问题描述】:

我正在尝试通过关注this example 在 nativescript(角度 2)中获得自定义对话框模式弹出窗口。

知道为什么在单击 SHOW 按钮时出现以下异常:

EXCEPTION: No component factory found for DialogContent (d:\npn\qwe\node_modules\@angular\core\bundles\core.umd.js:3462:27)
ORIGINAL STACKTRACE: (d:\npn\qwe\node_modules\@angular\core\bundles\core.umd.js:3467:31)
Error: No component factory found for DialogContent
    at NoComponentFactoryError.Error (native)
    at NoComponentFactoryError.BaseError [as constructor] (/data/data/org.nativescript.qwe/files/app/tns_modules/@angular/core/bundles/core.umd.js:1255:38)
    at new NoComponentFactoryError (/data/data/org.nativescript.qwe/files/app/tns_modules/@angular/core/bundles/core.umd.js:6053:20)
    at _NullComponentFactoryResolver.resolveComponentFactory (/data/data/org.nativescript.qwe/files/app/tns_modules/@angular/core/bundles/core.umd.js:6062:19)
    at NgModuleInjector.CodegenComponentFactoryResolver.resolveComponentFactory (/data/data/org.nativescript.qwe/files/app/tns_modules/@angular/core/bundles/core.umd.js:6087:39)
    at DetachedLoader.loadInLocation (/data/data/org.nativescript.qwe/files/app/tns_modules/nativescript-angular/common/detached-loader.js:18:37)
    at DetachedLoader.loadComponent (/data/data/org.nativescript.qwe/files/app/tns_modules/nativescript-angular/common/detached-loader.js:30:21)
    at ModalDialogService.showDialog (/data/data/org.nativescript.qwe/files/app/tns_modules/nativescript-angular/directives/dialogs.js:51:36)
    at /data/data/org.nativescript.qwe/files/app/tns_modules/nativescript-angular/directives/dialogs.js:27:51
  at ZoneDelegate.invokeTask (/data/data/org.nativescript.qwe/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:37) (d:\npn\qwe\node_modules\@angular\core\bundles\core.umd.js:3468:31)

【问题讨论】:

    标签: angular nativescript


    【解决方案1】:

    我在another so.找到了解决方案,在主模块中你要添加:

    @NgModule({
       ....
        declarations: [ DialogContent ],
        entryComponents: [ DialogContent ]
    })
    

    【讨论】:

    • 好人,还要确保你的 import { DialogContent } from './components/app/dialogcontent 文件中有这个导入 app.module.ts
    猜你喜欢
    • 2015-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-04
    • 2018-08-30
    • 2012-08-13
    • 2013-01-06
    • 2012-08-27
    相关资源
    最近更新 更多