gpt4 book ai didi

angular - 步进器 - Angular Material - 无法读取未定义的属性 'markForCheck'

转载 作者:行者123 更新时间:2023-12-01 23:16:32 24 4
gpt4 key购买 nike

无法获得 Angular Material 步进器。步进器显示按照要求,当单击标题时正在移动,但出现错误并显示:

Cannot read property markForCheck of undefined

此外,当我想使用按钮指令时,会抛出类似的错误,

Cannot read property previous of undefined

也许有一些帮助

代码:我只是从 Angular Material 页面复制粘贴默认代码:

https://material.angular.io/components/stepper/overview

我从主模块加载 Angular Material 到子模块中。

也许延迟加载导致了这个问题?

版本:

"@angular/animations": "^5.1.2",
"@angular/cdk": "^5.1.2",
"@angular/common": "^5.1.2",
"@angular/compiler": "^5.1.2",
"@angular/compiler-cli": "^5.1.2",
"@angular/core": "^5.1.2",
"@angular/forms": "^5.1.2",
"@angular/http": "^5.1.2",
"@angular/material": "^5.1.2",
"@angular/platform-browser": "^5.1.2",
"@angular/platform-browser-dynamic": "^5.1.2",
"@angular/platform-server": "^5.1.2",
"@angular/router": "^5.1.2",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.25",
"@ngui/auto-complete": "^0.16.0",
"@swimlane/ngx-charts": "^6.1.0",
"@types/file-saver": "0.0.1",
"@types/lodash": "^4.14.73",
"angular-2-data-table": "^0.1.2",
"angular-datatables": "^4.2.0",
"angular2-datatable": "^0.6.0",
"angular2-multiselect-dropdown": "^1.3.6",
"angular2-promise-buttons": "^2.0.1",
"chart.js": "^2.7.0",
"core-js": "^2.4.1",
"d3": "^4.11.0",
"datatables.net": "^1.10.15",
"datatables.net-buttons": "^1.5.1",
"datatables.net-buttons-dt": "^1.5.1",
"datatables.net-dt": "^1.10.15",
"file-saver": "^1.3.3",
"hammerjs": "^2.0.8",
"jquery": "^3.2.1",
"lodash": "^4.17.4",
"ng2-charts": "^1.6.0",
"ng2-pdf-viewer": "^1.2.2",
"ng2-slimscroll": "^2.0.1",
"ngx-chips": "^1.6.2",
"ngx-cookie-service": "^1.0.7",
"ngx-dropzone-wrapper": "^4.6.0",
"rxjs": "^5.5.6",
"sweetalert2": "^6.6.8",
"web-animations-js": "^2.3.1",
"xlsx": "^0.11.5",
"zone.js": "^0.8.16"

史蒂芬

最佳答案

将 typescript 转换为 es6 时,我遇到了同样的问题。 Chrome 似乎无法识别 es6 模块,因此未加载 Material 步进器所需的导入。

检查你的 tsconfig.json (不是 tsconfig.app.json) 你是否将你的 typescript 转译为 es6?如果是这样,你可以将其更改为 es5,它现在对我有用

tsconfig.json 
{
...
"compilerOptions": {
...
"target": "es5",
...
}
}

关于angular - 步进器 - Angular Material - 无法读取未定义的属性 'markForCheck',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48036238/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com