我将Angular 6与CLI结合使用,在构建应用程序时出现以下错误。
Error 虽然相同的代码可以更早地工作,但是对于所有其他组件,虽然它们使用相同的代码,但它们没有收到此错误
我没有使用webpack。
import { Component, OnInit } from "@angular/core";
import { ScenariosService } from "./scenarios.service";
import { GridDataResult, DataStateChangeEvent } from "@progress/kendo-angular-grid";
import { State } from "@progress/kendo-data-query";
import { Observable } from "rxjs";
import { SolutionsService } from "../solutions/solutions.service";
import { CookieService } from "ngx-cookie-service";
import { FormGroup, FormControl, Validators } from '@angular/forms';
import {IScenarioList} from './IscenarioList';
@Component({
selector: "app-scenarios",
templateUrl: "./scenarios.component.html",
styleUrls: ["./scenarios.component.css"]
})
export class ScenariosComponent implements OnInit {
scenarios: any = [];
public gridData: GridDataResult;
public pageSize = 100;
public skip = 0;
public state: State = {
skip: 0,
take: 20
};
public view: Observable<GridDataResult>;
solsdata: string;
private editedRowIndex: number;
public formGroup: FormGroup;
constructor(private scenarioservice: ScenariosService, private solutionservice: SolutionsService, private cookieservice: CookieService) { }
ngOnInit() {
this.view = this.scenarioservice;
this.solsdata = this.cookieservice.get("SolutionId");
this.scenarioservice.query(this.state, this.solsdata);
}
}
谢谢
答案 0 :(得分:0)
就像评论说的那样,您缺少}括号。
应为:
@Component({
selector: "app-sln",
templateUrl: "./sln.component.html"})
答案 1 :(得分:0)
我刚刚创建了一个单独的组件,并将所有代码粘贴到了新组件中,并且在那里工作了。无法找到错误的实际原因。