【问题标题】:Onsen ui + Angular 2 giving this._content_.show is not a function errorOnsen ui + Angular 2 给出 this._content_.show 不是函数错误
【发布时间】:2017-06-01 12:02:57
【问题描述】:

操作系统?

Linux Mint 18.1

版本。

angular-cli: 1.0.0-beta.24
node: 7.4.0
os: linux x64
@angular/common: 2.4.3
@angular/compiler: 2.4.3
@angular/core: 2.4.3
@angular/forms: 2.4.3
@angular/http: 2.4.3
@angular/platform-browser: 2.4.3
@angular/platform-browser-dynamic: 2.4.3
@angular/router: 3.4.3
@angular/compiler-cli: 2.4.3

重现步骤。

这是不是使用 CLI 创建的应用程序吗?你对你的代码做了什么改变?等等。 我想在我自己的 Angular 应用程序中实现 onsen-ui ons-splitter 标签https://onsen.io/v2/docs/angular2/ons-splitter-content.html。我将要拆分的两个组件导入到一个文件中,并将单个文件导入为 NgModule。因此,在运行 Angular 应用程序时,控制台首先给了我一个与此问题 #3975 相对应的错误。因此,按照解决问题的建议,我在我的 Angular 项目文件夹中发出了命令 npm install --save zone.js@0.7.4 。 在声明中同时包含 contentComponent 和 sidePageComponet 以及 entryComponent 字段后,我遇到了一个新错误,我找不到任何解决方案。

失败给出的日志。

EXCEPTION: this._content._show is not a function
ErrorHandler.handleError @ error_handler.js:50
next @ application_ref.js:346
schedulerFn @ async.js:91
SafeSubscriber.__tryOrUnsub @ Subscriber.js:223
SafeSubscriber.next @ Subscriber.js:172
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ async.js:77
NgZone.triggerError @ ng_zone.js:329
onHandleError @ ng_zone.js:290
ZoneDelegate.handleError @ zone.js:246
Zone.runTask @ zone.js:154
ZoneTask.invoke @ zone.js:345
data.args.(anonymous function) @ zone.js:1224
(anonymous) @ setImmediate.js:48
runIfPresent @ setImmediate.js:67
onGlobalMessage @ setImmediate.js:113
error_handler.js:55 ORIGINAL STACKTRACE:
ErrorHandler.handleError @ error_handler.js:55
next @ application_ref.js:346
schedulerFn @ async.js:91
SafeSubscriber.__tryOrUnsub @ Subscriber.js:223
SafeSubscriber.next @ Subscriber.js:172
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ async.js:77
NgZone.triggerError @ ng_zone.js:329
onHandleError @ ng_zone.js:290
ZoneDelegate.handleError @ zone.js:246
Zone.runTask @ zone.js:154
ZoneTask.invoke @ zone.js:345
data.args.(anonymous function) @ zone.js:1224
(anonymous) @ setImmediate.js:48
runIfPresent @ setImmediate.js:67
onGlobalMessage @ setImmediate.js:113
error_handler.js:56 TypeError: this._content._show is not a function
at HTMLElement._show (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :23221:21)
at eval (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :23210:27)
at ZoneDelegate.invokeTask (http://localhost:4200/vendor.bundle.js:111568:35)
at Object.onInvokeTask (http://localhost:4200/vendor.bundle.js:32533:37)
at ZoneDelegate.invokeTask (http://localhost:4200/vendor.bundle.js:111567:40)
at Zone.runTask (http://localhost:4200/vendor.bundle.js:111444:47)
at ZoneTask.invoke (http://localhost:4200/vendor.bundle.js:111638:33)
at data.args.(anonymous function) (http://localhost:4200/vendor.bundle.js:112517:25)
at eval (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :3341:25)
at runIfPresent (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :3360:21)
at onGlobalMessage (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :3406:17)
ErrorHandler.handleError @ error_handler.js:56
next @ application_ref.js:346
schedulerFn @ async.js:91
SafeSubscriber.__tryOrUnsub @ Subscriber.js:223
SafeSubscriber.next @ Subscriber.js:172
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ async.js:77
NgZone.triggerError @ ng_zone.js:329
onHandleError @ ng_zone.js:290
ZoneDelegate.handleError @ zone.js:246
Zone.runTask @ zone.js:154
ZoneTask.invoke @ zone.js:345
data.args.(anonymous function) @ zone.js:1224
(anonymous) @ setImmediate.js:48
runIfPresent @ setImmediate.js:67
onGlobalMessage @ setImmediate.js:113
Subscriber.js:227 Uncaught TypeError: this._content._show is not a function
at HTMLElement._show (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :23221:21)
at eval (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :23210:27)
at ZoneDelegate.invokeTask (http://localhost:4200/vendor.bundle.js:111568:35)
at Object.onInvokeTask (http://localhost:4200/vendor.bundle.js:32533:37)
at ZoneDelegate.invokeTask (http://localhost:4200/vendor.bundle.js:111567:40)
at Zone.runTask (http://localhost:4200/vendor.bundle.js:111444:47)
at ZoneTask.invoke (http://localhost:4200/vendor.bundle.js:111638:33)
at data.args.(anonymous function) (http://localhost:4200/vendor.bundle.js:112517:25)
at eval (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :3341:25)
at runIfPresent (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :3360:21)
at onGlobalMessage (eval at module.exports (http://localhost:4200/scripts.bundle.js:14:8), :3406:17)
_show @ ons-splitter-content.js:190
(anonymous) @ ons-splitter-content.js:181
ZoneDelegate.invokeTask @ zone.js:275
onInvokeTask @ ng_zone.js:260
ZoneDelegate.invokeTask @ zone.js:274
Zone.runTask @ zone.js:151
ZoneTask.invoke @ zone.js:345
data.args.(anonymous function) @ zone.js:1224
(anonymous) @ setImmediate.js:48
runIfPresent @ setImmediate.js:67
onGlobalMessage @ setImmediate.js:113

【问题讨论】:

    标签: angular onsen-ui


    【解决方案1】:

    在本教程 splitter-tutorial 中,使用 ons-page 作为 sidePageComponent 和 contentPageComponent 的选择器会引发上述错误。因此,本教程应该使用不同的选择器名称进行更改,例如 ons-page[content] 和 ons-page[side]。

    【讨论】:

      猜你喜欢
      • 2018-08-11
      • 2018-03-10
      • 1970-01-01
      • 2022-01-11
      • 2019-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-11
      相关资源
      最近更新 更多