小编Avi*_*h.k的帖子

在 angular 服务之一中使用“ElementRef”时出错

错误错误:未捕获(承诺):错误:StaticInjectorError(AppModule)[ElementRef]:
StaticInjectorError(平台:核心)[ElementRef]:NullInjectorError:没有提供ElementRef!错误:StaticInjectorError(AppModule)[ElementRef]:
StaticInjectorError(Platform:core)[ElementRef]:NullInjectorError: ElementRef 没有提供者!

这是我在我的ElementRef一项服务中使用 angular5 时遇到的错误,我确实像这样导入了它:

import { Injectable,ElementRef } from '@angular/core';
Run Code Online (Sandbox Code Playgroud)

angular elementref

2
推荐指数
1
解决办法
8802
查看次数

标签 统计

angular ×1

elementref ×1