温度ui + Angular 2给出this._content_.show不是函数错误

时间:2017-01-17 12:15:25

标签: angular onsen-ui

OS吗

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

Repro步骤。

这是不是使用CLI创建的应用程序吗?您对代码做了哪些更改?等等 我想在我自己的角度应用程序中实现onsen-ui ons-splitter标记https://onsen.io/v2/docs/angular2/ons-splitter-content.html。我将要拆分的两个组件导入到一个文件中,然后将单个文件导入为NgModule。因此,在运行角度应用程序时,控制台首先给出了一个与此问题#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

1 个答案:

答案 0 :(得分:0)

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