无法识别@ angular / material?

问题描述

我正在使用stackblitz来编译Angular应用程序,并且还在依赖项中添加@angular/material。我不知道为什么编译器无法识别我安装的依赖项。

enter image description here

解决方法

您必须从正确的位置导入模块

import {MatDatepickerModule} from '@angular/material/datepicker';
import {MatNativeDateModule} from '@angular/material/core';

这是一个Stackblitz,我是根据您的示例创建的