无法读取未定义的属性“ coerceBooleanProperty”

时间:2018-11-01 09:07:59

标签: angular material cdk

我在Angular CLI世界之外使用Angular和Material的UMD模块以及CDK。这是因为我们拥有SPL(软件产品线)。

我要升级到Angular 7.0.2,Material 7.0.2和CDK 7.0.2。

当我尝试加载包含输入字段的表单时,遇到此错误:

MatFormField.html:1 ERROR TypeError: Cannot read property 'coerceBooleanProperty' of undefined
    at CdkObserveContent.set [as disabled] (cdkObserversUmd.js:200)
    at updateProp (coreUmd.js:18853)
    at checkAndUpdateDirectiveInline (coreUmd.js:18604)
    at checkAndUpdateNodeInline (coreUmd.js:19911)
    at checkAndUpdateNode (coreUmd.js:19873)
    at debugCheckAndUpdateNode (coreUmd.js:20507)
    at debugCheckDirectivesFn (coreUmd.js:20467)
    at Object.eval [as updateDirectives] (MatFormField.html:1)
    at Object.debugUpdateDirectives [as updateDirectives] (coreUmd.js:20459)
    at checkAndUpdateView (coreUmd.js:19855)

View_MatFormField_3 @   MatFormField.html:1
DebugContext_.logError  @   coreUmd.js:20711
ErrorHandler.handleError    @   coreUmd.js:12683
(anonymous) @   coreUmd.js:14929
ZoneDelegate.invoke @   zone.js:388
Zone.run    @   zone.js:138
NgZone.runOutsideAngular    @   coreUmd.js:14153
ApplicationRef.tick @   coreUmd.js:14929
(anonymous) @   coreUmd.js:14813
ZoneDelegate.invoke @   zone.js:388
onInvoke    @   coreUmd.js:14194
ZoneDelegate.invoke @   zone.js:387
Zone.run    @   zone.js:138
NgZone.run  @   coreUmd.js:14108
next    @   coreUmd.js:14813
schedulerFn @   coreUmd.js:10299
SafeSubscriber.__tryOrUnsub @   rxUmd.js:889
SafeSubscriber.next @   rxUmd.js:827
Subscriber._next    @   rxUmd.js:771
Subscriber.next @   rxUmd.js:748
Subject.next    @   rxUmd.js:1167
EventEmitter.emit   @   coreUmd.js:10283
checkStable @   coreUmd.js:14163
onLeave @   coreUmd.js:14230
onInvoke    @   coreUmd.js:14197
ZoneDelegate.invoke @   zone.js:387
Zone.run    @   zone.js:138
NgZone.run  @   coreUmd.js:14108
(anonymous) @   platformBrowserAnimationsUmd.js:229
ZoneDelegate.invoke @   zone.js:388
Zone.run    @   zone.js:138
(anonymous) @   zone.js:872
ZoneDelegate.invokeTask @   zone.js:421
Zone.runTask    @   zone.js:188
drainMicroTaskQueue @   zone.js:595
ZoneTask.invokeTask @   zone.js:500
invokeTask  @   zone.js:1540
globalZoneAwareCallback @   zone.js:1566

我试图了解导致错误的原因,并发现在CdkObserverUmd.js中,coercion参数由于某种原因未初始化:

(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/coercion'), require('@angular/core'), require('rxjs'), require('rxjs/operators')) :
    typeof define === 'function' && define.amd ? define('@angular/cdk/observers', ['exports', '@angular/cdk/coercion', '@angular/core', 'rxjs', 'rxjs/operators'], factory) :
    (factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.observers = {}),global.ng.cdk.coercion,global.ng.core,global.rxjs,global.rxjs.operators));
}(this, (function (exports,coercion,core,rxjs,operators) { 'use strict';

但是我不知道为什么会这样。有帮助吗?

0 个答案:

没有答案