Javascript 添加字体图标
我想在我开发的应用程序中添加令人敬畏的字体图标,但它产生了一个我不理解的错误 首先,我使用NPM在项目中通过在提示符处键入以下内容来搜索字体:Javascript 添加字体图标,javascript,angular,font-awesome,Javascript,Angular,Font Awesome,我想在我开发的应用程序中添加令人敬畏的字体图标,但它产生了一个我不理解的错误 首先,我使用NPM在项目中通过在提示符处键入以下内容来搜索字体: npm install font-awesome@4.7.0 --save 然后,我在src文件夹中添加了一个名为_variables.scss的新文件,并添加了以下内容: $fa-font-path : '../node_modules/font-awesome/fonts'; 然后,打开styles.scss文件并按如下方式更新: . . .
npm install font-awesome@4.7.0 --save
然后,我在src文件夹中添加了一个名为_variables.scss的新文件,并添加了以下内容:
$fa-font-path : '../node_modules/font-awesome/fonts';
然后,打开styles.scss文件并按如下方式更新:
. . .
@import 'variables';
@import '../node_modules/font-awesome/scss/font-awesome';
. . .
但是,当我使用ng service--open
启动服务时,我得到以下信息:
$fa-font-path : '../node_modules/font-awesome/fonts';
C:\Users\antoi\Documents\Programming\Teaching\Me\FullStack\Angular\conflusion>ng serve——打开
10%正在构建3/3模块0 activei(wds):项目正在运行
i「wds」:网页包输出由/
i「wds:404s将回退到//index.html
chunk {main} main.js, main.js.map (main) 2.08 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 122 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.09 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 394 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 339 kB [initial] [rendered]
Date: 2019-08-26T10:11:22.403Z - Hash: 8fbb15623a903204f6d1 - Time: 11587ms
ERROR in node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts:62:22 - error TS2420: Class 'MockMediaQueryList' incorrectly implements interface 'MediaQueryList'.
Type 'MockMediaQueryList' is missing the following properties from type 'MediaQueryList': onchange, addEventListener, removeEventListener, dispatchEvent
62 export declare class MockMediaQueryList implements MediaQueryList {
~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts:79:27 - error TS2304: Cannot find name 'MediaQueryListListener'.
79 addListener(listener: MediaQueryListListener): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts:81:23 - error TS2304: Cannot find name 'MediaQueryListListener'.
81 removeListener(_: MediaQueryListListener): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts:11:22 - error TS2420: Class 'ServerMediaQueryList' incorrectly implements interface 'MediaQueryList'.
Type 'ServerMediaQueryList' is missing the following properties from type 'MediaQueryList': onchange, addEventListener, removeEventListener, dispatchEvent
11 export declare class ServerMediaQueryList implements MediaQueryList {
~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts:28:27 - error TS2304: Cannot find name 'MediaQueryListListener'.
28 addListener(listener: MediaQueryListListener): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts:30:23 - error TS2304: Cannot find name 'MediaQueryListListener'.
30 removeListener(_: MediaQueryListListener): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts:42:15 - error TS2416: Property '_registry' in type 'ServerMatchMedia' is not assignable to the same property in base type 'MatchMedia'.
Type 'Map<string, ServerMediaQueryList>' is not assignable to type 'Map<string, MediaQueryList>'.
Type 'ServerMediaQueryList' is missing the following properties from type 'MediaQueryList': onchange, addEventListener, removeEventListener, dispatchEvent
42 protected _registry: Map<string, ServerMediaQueryList>;
~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts:54:15 - error TS2416: Property '_buildMQL' in type 'ServerMatchMedia' is not assignable to the same property in base type 'MatchMedia'.
Type '(query: string) => ServerMediaQueryList' is not assignable to type '(query: string) => MediaQueryList'.
Type 'ServerMediaQueryList' is not assignable to type 'MediaQueryList'.
54 protected _buildMQL(query: string): ServerMediaQueryList;
~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/observable-media/observable-media.d.ts:11:14 - error TS2416: Property 'subscribe' in type 'ObservableMedia' is not assignable to the same property in base type 'Subscribable<MediaChange>'.
Type '(next?: (value: MediaChange) => void, error?: (error: any) => void, complete?: () => void) => Subscription' is not assignable to type '{ (observer?: PartialObserver<MediaChange>): Unsubscribable; (next: null, error: null, complete: () => void): Unsubscribable; (next: null, error: (error: any) => void, complete?: () => void): Unsubscribable; (next: (value: MediaChange) => void, error: null, complete: () => void): Unsubscribable; (next?: (value: Medi...'.
Types of parameters 'next' and 'observer' are incompatible.
Type 'PartialObserver<MediaChange>' is not assignable to type '(value: MediaChange) => void'.
Type 'NextObserver<MediaChange>' is not assignable to type '(value: MediaChange) => void'.
Type 'NextObserver<MediaChange>' provides no match for the signature '(value: MediaChange): void'.
11 abstract subscribe(next?: (value: MediaChange) => void, error?: (error: any) => void, complete?: () => void): Subscription;
~~~~~~~~~
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Failed to compile.
我在本地主机上没有更多的渲染。但是如果我删除了页眉和页脚,我将再次进行渲染。但是,对于第一种情况,对于另一种情况,我没有错误。您可以尝试
angular font awesome
软件包
npm i angular-font-awesome --save
现在将模块添加到app.module.ts中:
import {AngularFontAwesomeModule} from 'angular-font-awesome';
然后在导入数组中也添加它
imports: [
..
AngularFontAwesomeModule
];
您可以尝试使用
angular font awesome
软件包
npm i angular-font-awesome --save
现在将模块添加到app.module.ts中:
import {AngularFontAwesomeModule} from 'angular-font-awesome';
然后在导入数组中也添加它
imports: [
..
AngularFontAwesomeModule
];
有官方的字体真棒组件:有官方的字体真棒组件: