步进器-角材料-无法读取未定义的属性'markForCheck' [英] Stepper - Angular Material - Cannot read property 'markForCheck' of undefined

查看:134
本文介绍了步进器-角材料-无法读取未定义的属性'markForCheck'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不能使角材步进器变精细.按要求显示的步进器显示以及单击标题时都在移动,但是出现错误并说:

Can't get the angular material stepper fine. The stepper display as asked and when clicked on the header is moving, but an error come and say:

无法读取未定义的属性markForCheck

另外,当我想使用按钮指令时,会抛出类似

Also when i want to use the buttons directives throw an error like,

无法读取未定义的属性previous

也许有帮助

代码: 我只是从角度材料页面复制粘贴默认代码:

Code: I just copy paste the default code from the angular material page:

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

我从主模块将角形材料加载到子模块中.

I load angular material in an child module from my main.

也许延迟加载会导致此问题?

Maybe the lazy loading cause this problem ?

版本:

"@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"

Stephane

推荐答案

将我的打字稿转换为es6时,我遇到了同样的问题. Chrome似乎无法识别es6模块,因此没有加载必要的导入材料的步进器.

I had the same issue when transpiling my typescript to es6. Chrome didn't seem to recognise es6 modules and so the necessary imports were not loaded for material's stepper.

检查您的tsconfig.json(而不是tsconfig.app.json)是否将打字稿转换为es6?如果是这样,您可以将其更改为es5,现在对我有效

Check your tsconfig.json (not the tsconfig.app.json) Are you transpiling your typescript to es6? if so, you can change that to es5, it works now for me

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

这篇关于步进器-角材料-无法读取未定义的属性'markForCheck'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆