小编MRD*_*R97的帖子

错误TS2315:类型'ElementRef'不是通用的

我试图在我的应用程序中使用@ angular/materials并且它正在成功编译,但是我收到以下错误:

webpack: Compiled successfully.
ERROR in node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(136,20): error TS2315: Type 'ElementRef' is not generic.
node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(154,104): error TS2315: Type 'ElementRef' is not generic.
node_modules/@angular/material/slide-toggle/typings/slide-toggle.d.ts(53,15): error TS2315: Type 'ElementRef' is not generic.
node_modules/@angular/material/slide-toggle/typings/slide-toggle.d.ts(55,18): error TS2315: Type 'ElementRef' is not generic.
Run Code Online (Sandbox Code Playgroud)

这似乎不是一个常见问题,有没有人知道如何解决?

使用:

Angular CLI: 1.7.4
Node: 8.11.1
OS: win32 x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 6.0.0-rc.14-29bf024
@angular/cli: 1.7.4
@angular/material: 6.0.0-rc.14-29bf024
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: …
Run Code Online (Sandbox Code Playgroud)

npm typescript angular-material angular

8
推荐指数
2
解决办法
2万
查看次数

"您已在此页面上多次添加Google Maps API"错误

我的html页面中有以下内容:

    <script type="text/javascript"
            src="http://maps.googleapis.com/maps/api/js?libraries=geometry&sensor=false">
    </script>
    <script 
        async defer
        src="https://maps.googleapis.com/maps/api/js?key=hUnDAdjYG_Wz7u2qL6unHqfBOmvaZ0H1Mg&callback=initMap">
    </script>
Run Code Online (Sandbox Code Playgroud)

第一个链接用于Google的API Geometry Library,第二个链接用于初始化并绘制地图.

我收到错误消息"您已在此页面上多次包含Google Maps API.这可能会导致意外错误."

我知道只需调用一个脚本并更改参数即可解决此问题,请参阅修复"您已在此页面上多次包含Google Maps API.这可能会导致意外错误." 我不知道如何为我的问题复制答案.

html javascript google-maps google-maps-api-3

5
推荐指数
1
解决办法
3万
查看次数