Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度2物料步进器不工作_Angular_Angular Material - Fatal编程技术网

Angular 角度2物料步进器不工作

Angular 角度2物料步进器不工作,angular,angular-material,Angular,Angular Material,嗨,我在一个Angular 2项目上工作,经常使用材料模块。由于某些原因,我甚至无法将步进模块导入到我的项目中。因此,我最终导入整个材质模块,如下所示: import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { StepperComponent } from './stepper.component'; import { MaterialModule } f

嗨,我在一个Angular 2项目上工作,经常使用材料模块。由于某些原因,我甚至无法将步进模块导入到我的项目中。因此,我最终导入整个材质模块,如下所示:

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { StepperComponent } from './stepper.component';
import { MaterialModule } from '@angular/material';


@NgModule({
  imports: [CommonModule, MaterialModule],
  declarations: [StepperComponent],
  exports: [StepperComponent]
})

export class StepperModule {}
我在html中使用它来测试它的导入

<mat-horizontal-stepper></mat-horizontal-stepper>

然后我得到以下错误

polyfills.dll.js:24743 Unhandled Promise rejection: Template parse errors:
'mat-horizontal-stepper' is not a known element:
1. If 'mat-horizontal-stepper' is an Angular component, then verify that it is part of this module.
2. If 'mat-horizontal-stepper' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<mat-horizontal-stepper></mat-horizontal-stepper>"): t@0:0 ; Zone: <root> ; Task: Promise.then ; Value: 
polyfills.dll.js:24743未处理的承诺拒绝:模板分析错误:
“mat水平步进器”不是已知元素:
1.如果“mat水平步进器”是一个角度组件,则确认它是该模块的一部分。
2.如果“mat horizontal stepper”是一个Web组件,则将“CUSTOM_ELEMENTS_SCHEMA”添加到此组件的“@NgModule.schemas”以抑制此消息。(“[ERROR->]”:t@0:0 ; 区域:;任务:承诺;价值:

我能够使用很多材料模块。这个唯一的问题。有什么想法吗,伙计们?提前感谢。

您确定导入的模块正确吗?确保在您的
应用程序模块.ts
中,您具有导入到
MatStepperModule
材料模块的权限(已从
2.0.0-beta.11
中删除,请参阅):

从'@angular/material'导入{MatStepperModule};
@NGD模块({
进口:[
MatStepperModule,
// ...
]
})

它无法工作的原因是因为stepper组件是从
2.0.0-beta.11
中新添加的(有关更多信息,请参阅,如上所述,删除
MaterialModule

发布您的app.module.ts代码。您是否在Stepper组件中使用?是的,正如我在问题中提到的,我使用的是
。与
app.module.ts
无关,因为
StepperModule
正在导入materialmodule。stepper组件是从
2.0.0-beta.11
引入的,它结束了对
materialmodule
的支持。(你读过变更日志吗??)