core.js:15724错误错误:未捕获(承诺):错误:StaticInjectorError(AppModule)[IDOLSandkeyDiagram-> ColorSequenceService]:

时间:2019-07-02 04:21:03

标签: javascript angular

大家好,我在名为IDOLSandkeyDiagram的组件上遇到以下错误。

core.js:15724 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[IDOLSandkeyDiagram -> ColorSequenceService]: 
  StaticInjectorError(Platform: core)[IDOLSandkeyDiagram -> ColorSequenceService]: 
    NullInjectorError: No provider for ColorSequenceService!
Error: StaticInjectorError(AppModule)[IDOLSandkeyDiagram -> ColorSequenceService]: 
  StaticInjectorError(Platform: core)[IDOLSandkeyDiagram -> ColorSequenceService]: 
    NullInjectorError: No provider for ColorSequenceService!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:8896)
    at resolveToken (core.js:9141)
    at tryResolveToken (core.js:9085)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982)
    at resolveToken (core.js:9141)
    at tryResolveToken (core.js:9085)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982)
    at resolveNgModuleDep (core.js:21218)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:21907)
    at resolveNgModuleDep (core.js:21218)
    at resolvePromise (zone.js:831)
    at resolvePromise (zone.js:788)
    at zone.js:892
    at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:17290)
    at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at drainMicroTaskQueue (zone.js:601)
    at ZoneTask../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:502)
    at invokeTask (zone.js:1744)

HTML

<div>
    <app-IDOLSandkeyDiagram></app-IDOLSandkeyDiagram>
</div>

TS

import { Component, Output, Input } from '@angular/core';
import { Color, ColorSequence, ColorSequenceService } from '@micro-focus/ux-aspects';
import { PartitionMapSegment, ThemeColor } from '@ux-aspects/ux-aspects';

@Component({
    selector: 'app-IDOLSandkeyDiagram',
    templateUrl: './IDOLSandkeyDiagram.component.html',
    styleUrls: ['./IDOLSandkeyDiagram.component.css']
})
export class IDOLSandkeyDiagram {

    @Input() dataset: Readonly<PartitionMapSegment> = {
        name: 'My Workspace',
        children: [
            {
                name: 'Financial Data',
                children: [
                    { name: 'Sensitive', value: 60 },
                    { name: 'Partially Sensitive', value: 60 },
                    { name: 'To be retained', value: 120 },
                    { name: 'Redundant', value: 30 },
                    { name: 'Obsolete', value: 30 },
                ]
            },
            {
                name: 'Identification Data',
                children: [
                    { name: 'Sensitive', value: 60 },
                    { name: 'Partially Sensitive', value: 60 },
                    { name: 'To be retained', value: 60 },
                    { name: 'Redundant', value: 10 },
                    { name: 'Obsolete', value: 10 },
                ]
            },
            {
                name: 'Contact Data',
                children: [
                    { name: 'Sensitive', value: 30 },
                    { name: 'Partially Sensitive', value: 30 },
                    { name: 'To be retained', value: 30 },
                    { name: 'Redundant', value: 5 },
                    { name: 'Obsolete', value: 5 },
                ]
            },
            {
                name: 'Account Data',
                children: [
                    { name: 'Sensitive', value: 15 },
                    { name: 'Partially Sensitive', value: 15 },
                    { name: 'To be retained', value: 15 },
                    { name: 'Redundant', value: 2 },
                    { name: 'Obsolete', value: 0 },
                ]
            }
        ]
    };

    colors: (Color | ThemeColor)[][] = [
        [Color.DimGray],
        [Color.Gray, Color.BrightGray],
        this._colorSequence.getSequence(ColorSequence.Status)
    ];

    constructor(private _colorSequence: ColorSequenceService) { }
}

1 个答案:

答案 0 :(得分:0)

您需要在app.module.ts或使用此服务的模块中的提供者下方添加 array(3) { [55]=> array(1) { [0]=> array(3) { ["id"]=> int(104) ["book_id"]=> int(32) ["price"]=> int(55) } } [65]=> array(3) { [0]=> array(3) { ["id"]=> int(117) ["book_id"]=> int(76) ["price"]=> int(65) } [1]=> array(3) { ["id"]=> int(135) ["book_id"]=> int(77) ["price"]=> int(65) } [2]=> array(3) { ["id"]=> int(100) ["book_id"]=> int(78) ["price"]=> int(65) } } [85]=> array(1) { [0]=> array(3) { ["id"]=> int(101) ["book_id"]=> int(21) ["price"]=> int(85) } } }