Questions tagged «angular8»


6
在TypeScript中导入json文件
我有一个如下JSON文件: { "primaryBright": "#2DC6FB", "primaryMain": "#05B4F0", "primaryDarker": "#04A1D7", "primaryDarkest": "#048FBE", "secondaryBright": "#4CD2C0", "secondaryMain": "#00BFA5", "secondaryDarker": "#009884", "secondaryDarkest": "#007F6E", "tertiaryMain": "#FA555A", "tertiaryDarker": "#F93C42", "tertiaryDarkest": "#F9232A", "darkGrey": "#333333", "lightGrey": "#777777" } 我正在尝试将其导入.tsx文件。为此,我将其添加到类型定义中: declare module "*.json" { const value: any; export default value; } 我正在这样导入它。 import colors = require('../colors.json') 在文件中,我将颜色primaryMain用作colors.primaryMain。但是我得到一个错误: 属性'primaryMain'在类型'typeof“ * .json”上不存在

5
Angular 8-延迟加载模块:错误TS1323:仅当'--module'标志为'commonjs'或'esNext'时才支持动态导入
当我将Angular从7更新到Angular 8时,出现延迟加载模块错误 我尝试了角度升级指南中提供的选项 进行了以下更改: 之前 loadChildren: '../feature/path/sample- tage.module#SameTagModule' 后 loadChildren: () => import('../feature/path/sample- tags.module').then(m => m.CreateLinksModule) 错误TS1323:仅当'--module'标志为'commonjs'或'esNext'时,才支持动态导入。

7
储存库不干净。在Angular 8中进行更新之前,请提交或存储任何更改
错误 储存库不干净。请提交或存储任何更改,然后再进行更新 当我从版本7更新到Angular 8时。 Angular升级指南https://update.angular.io/#7.0:8.0 D:\app-test> ng update @angular/cli @angular/core npm cache verify 储存库不干净。请在更新之前提交或存储任何更改。 更新版本 PS D:\app-test> ng update Using package manager: 'npm' Collecting installed dependencies... Found 58 dependencies. We analyzed your package.json, there are some packages to update: Name Version Command to update -------------------------------------------------------------------------------- @angular/cdk 7.2.2 -> 8.0.1 ng …

13
如何在Angular 8应用程序中支持Internet Explorer?
当我使用Angular CLI(8.0.0)生成项目时,运行ng serve,在Internet Explorer中打开应用程序,然后出现空白屏幕。 我看了看polyfills.ts文件,并取消了以下几行的注释: import 'classlist.js'; import 'web-animations-js'; 我还删除了所有core.js导入,因为Angular 8直接支持core.js 3.0。 我也跑了npm i。 package.json: "dependencies": { "@angular/animations": "~8.0.0", "@angular/common": "~8.0.0", "@angular/compiler": "~8.0.0", "@angular/core": "~8.0.0", "@angular/forms": "~8.0.0", "@angular/platform-browser": "~8.0.0", "@angular/platform-browser-dynamic": "~8.0.0", "@angular/router": "~8.0.0", "classlist.js": "^1.1.20150312", "rxjs": "~6.4.0", "tslib": "^1.9.0", "web-animations-js": "^2.3.1", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "~0.800.0", "@angular/cli": "~8.0.0", …

5
作业名称“ ..getProjectMetadata”不存在
我将我的角度更新为v9,当我尝试在v8中返回时,收到此错误。我已经尝试了以下方法: 卸载-global angular / cli 卸载angular / cli 回到我的最后一个package.json 删除node_module文件夹 删除仓库 该错误继续显示。 我的堆栈跟踪是: An unhandled exception occurred: Job name "..getProjectMetadata" does not exist. See angular-errors.log for further details. angular-errors.log: [error] Error: Job name "..getProjectMetadata" does not exist. at Observable._subscribe (/Front/node_modules/@angular-devkit/core/src/experimental/jobs/simple-scheduler.js:350:23) at Observable._trySubscribe (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Observable.js:44:25) at Observable.subscribe (/Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Observable.js:30:22) at /Front/node_modules/@angular-devkit/core/node_modules/rxjs/internal/util/subscribeTo.js:22:31 at Object.subscribeToResult …

4
ng生成时超出了呼叫重试异常
我在ng build(生成ES5捆绑包以进行差异加载...)时遇到了一个例外。 An unhandled exception occured: Call retires were exceeded 使用的版本: Angular-CLI: 8.3.20 角度: 8.2.7 节点: 12.12.1 在日志中也提到了 [error] Error: Call retries were exceeded at ChildProcessWorker.initialize

2
在Angular 8和9中提供和注入“窗口”与窗口之间有什么区别?
我有两个使用这些版本的Angular项目: 9.0.0-下一个6 8.1.0 在版本9中,我使用它来提供和注入window对象: @NgModule({ providers: [ { provide: Window, useValue: window }, ] }) export class TestComponent implements OnInit { constructor(@Inject(Window) private window: Window) } 哪个工作正常。 将这种方法用于版本8会在编译期间引发警告和错误: 警告:无法解析TestComponent的所有参数…… 我通过使用单引号解决了它,如下所示: @NgModule({ providers: [ { provide: 'Window', useValue: window }, ] }) export class TestComponent implements OnInit { constructor(@Inject('Window') private window: …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.