Skip to content

Additional newline after standalone in component template #29526

@michael-koch787

Description

@michael-koch787

Command

generate

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

18

Description

When opting-out of standalone components, ng g c adds an additional newline after the standalone property.

import { Component } from '@angular/core';

@Component({
  selector: 'elements-foo',
  standalone: false,
  
  templateUrl: './foo.component.html',
  styleUrl: './foo.component.css'
})
export class FooComponent {

}

Minimal Reproduction

Opt-out of standalone components:

angular.json

  "schematics": {
    "@schematics/angular:component": {
      "standalone": false
    }
  }

run ng g c foo

Exception or Error


Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 19.1.4
Node: 20.18.1
Package Manager: npm 11.0.0
OS: win32 x64

Angular: 19.1.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1901.4
@angular-devkit/build-angular      19.1.4
@angular-devkit/core               19.1.4
@angular-devkit/schematics         19.1.4
@angular/cdk                       19.1.1
@angular/cli                       19.1.4
@angular/material                  19.1.1
@angular/material-moment-adapter   19.1.1
@schematics/angular                19.1.4
rxjs                               7.8.1
typescript                         5.7.3
zone.js                            0.15.0

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions