Skip to content

Dev server error is present when template error is fixed #39147

@dereklin

Description

@dereklin

The issue is caused by package @angular/....

"@angular/animations": "~10.1.4",
"@angular/common": "~10.1.4",
"@angular/compiler": "~10.1.4",
"@angular/core": "~10.1.4",
"@angular/forms": "~10.1.4",
"@angular/platform-browser": "~10.1.4",
"@angular/platform-browser-dynamic": "~10.1.4",
"@angular/router": "~10.1.4",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"

Description

Dev server error is present when template error is fixed

🔬 Minimal Reproduction

install the latest version of @angular/cli

I am using

"@angular/cli": "~10.1.4",

create a brand new app like

ng new my-new-app

In app.component.html, copy and paste the following line inside of the main content div:

<h1 [style.color]="'red'">Hello World!</h1>

Change the first double quote to single quote to cause the template error. Then change it back to double quote to fix it.

In the terminal, these errors are shown:

    ERROR in src/app/app.module.ts:9:5 - error NG6001: The class 'AppComponent' is listed in the declarations of the NgModule 'AppModule', but is not a directive, a component, or a pipe. Either remove it from the NgModule's declarations, or add an appropriate Angular decorator.
    
    9     AppComponent
          ~~~~~~~~~~~~
    
      src/app/app.component.ts:8:14
        8 export class AppComponent {
                       ~~~~~~~~~~~~
        'AppComponent' is declared here.
    src/app/app.component.html:417:25 - error NG8002: Can't bind to 'ngSwitch' since it isn't a known property of 'div'.
    
    417   <div class="terminal" [ngSwitch]="selection.value">
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
      src/app/app.component.ts:5:16
        5   templateUrl: './app.component.html',
                         ~~~~~~~~~~~~~~~~~~~~~~
        Error occurs in the template of component AppComponent.
    src/app/app.component.html:535:1 - error NG8001: 'router-outlet' is not a known element:
    1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
    2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
    
    535 <router-outlet></router-outlet>
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
      src/app/app.component.ts:5:16
        5   templateUrl: './app.component.html',
                         ~~~~~~~~~~~~~~~~~~~~~~
        Error occurs in the template of component AppComponent.

You can read more about issue submission guidelines here:

🌍 Your Environment

It's a brand new angular app as of 10/6/2020:

"dependencies": {
"@angular/animations": "~10.1.4",
"@angular/common": "~10.1.4",
"@angular/compiler": "~10.1.4",
"@angular/core": "~10.1.4",
"@angular/forms": "~10.1.4",
"@angular/platform-browser": "~10.1.4",
"@angular/platform-browser-dynamic": "~10.1.4",
"@angular/router": "~10.1.4",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1001.4",
"@angular/cli": "~10.1.4",
"@angular/compiler-cli": "~10.1.4",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerfreq3: hightype: bug/fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions