diff --git a/packages/schematics/angular/application/files/module-files/src/app/app__suffix__.spec.ts.template b/packages/schematics/angular/application/files/module-files/src/app/app__suffix__.spec.ts.template index dfe31b1010c6..b12a559c7068 100644 --- a/packages/schematics/angular/application/files/module-files/src/app/app__suffix__.spec.ts.template +++ b/packages/schematics/angular/application/files/module-files/src/app/app__suffix__.spec.ts.template @@ -11,7 +11,8 @@ describe('App', () => { declarations: [ App ], - }).compileComponents(); + }) + .compileComponents(); }); it('should create the app', () => { @@ -20,7 +21,7 @@ describe('App', () => { expect(app).toBeTruthy(); }); - it('should render title', <% if(zoneless) { %>async <% } %>() => { + it('should render title', <% if (zoneless) { %>async <% } %>() => { const fixture = TestBed.createComponent(App); <%= zoneless ? 'await fixture.whenStable();' : 'fixture.detectChanges();' %> const compiled = fixture.nativeElement as HTMLElement; diff --git a/packages/schematics/angular/application/files/module-files/src/app/app__suffix__.ts.template b/packages/schematics/angular/application/files/module-files/src/app/app__suffix__.ts.template index 055586955b75..ef9aebaa0e14 100644 --- a/packages/schematics/angular/application/files/module-files/src/app/app__suffix__.ts.template +++ b/packages/schematics/angular/application/files/module-files/src/app/app__suffix__.ts.template @@ -1,7 +1,10 @@ import { Component, signal } from '@angular/core'; @Component({ - selector: '<%= selector %>',<% if(inlineTemplate) { %> + selector: '<%= selector %>', + standalone: false,<% if (inlineStyle) { %> + styles: [],<% } else { %> + styleUrl: './app<%= suffix %>.<%= style %>',<% } %><% if (inlineTemplate) { %> template: `
Congratulations! Your app is running. 🎉
@@ -11,9 +14,6 @@ import { Component, signal } from '@angular/core'; } %> `,<% } else { %> templateUrl: './app<%= suffix %>.html',<% } %> - standalone: false,<% if(inlineStyle) { %> - styles: []<% } else { %> - styleUrl: './app<%= suffix %>.<%= style %>'<% } %> }) export class App { protected readonly title = signal('<%= name %>'); diff --git a/packages/schematics/angular/application/files/module-files/src/app/app__typeSeparator__module.ts.template b/packages/schematics/angular/application/files/module-files/src/app/app__typeSeparator__module.ts.template index f7ad6f2cb515..1efc27f522e6 100644 --- a/packages/schematics/angular/application/files/module-files/src/app/app__typeSeparator__module.ts.template +++ b/packages/schematics/angular/application/files/module-files/src/app/app__typeSeparator__module.ts.template @@ -1,6 +1,5 @@ -import { NgModule, provideBrowserGlobalErrorListeners<% if(!zoneless) { %>, provideZoneChangeDetection<% } %> } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; -<% if (routing) { %> +import { NgModule, provideBrowserGlobalErrorListeners<% if (!zoneless) { %>, provideZoneChangeDetection<% } %> } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser';<% if (routing) { %> import { AppRoutingModule } from './app-routing<%= typeSeparator %>module';<% } %> import { App } from './app<%= suffix %>'; @@ -13,7 +12,7 @@ import { App } from './app<%= suffix %>'; AppRoutingModule<% } %> ], providers: [ - provideBrowserGlobalErrorListeners(),<% if(!zoneless) { %> + provideBrowserGlobalErrorListeners(),<% if (!zoneless) { %> provideZoneChangeDetection({ eventCoalescing: true }),<% } %> ], bootstrap: [App] diff --git a/packages/schematics/angular/application/files/module-files/src/main.ts.template b/packages/schematics/angular/application/files/module-files/src/main.ts.template index f74887b16867..0fcb878b1e23 100644 --- a/packages/schematics/angular/application/files/module-files/src/main.ts.template +++ b/packages/schematics/angular/application/files/module-files/src/main.ts.template @@ -1,8 +1,8 @@ -<% if(!!viewEncapsulation) { %>import { ViewEncapsulation } from '@angular/core'; -<% }%>import { platformBrowser } from '@angular/platform-browser'; +<% if (!!viewEncapsulation) { %>import { ViewEncapsulation } from '@angular/core'; +<% } %>import { platformBrowser } from '@angular/platform-browser'; import { AppModule } from './app/app<%= typeSeparator %>module'; platformBrowser().bootstrapModule(AppModule, { - <% if(!!viewEncapsulation) { %> defaultEncapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } %> + <% if (!!viewEncapsulation) { %> defaultEncapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } %> }) .catch(err => console.error(err)); diff --git a/packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template b/packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template index 8f0e1b0dc23a..20201fdb80ca 100644 --- a/packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template +++ b/packages/schematics/angular/application/files/standalone-files/src/app/app.config.ts.template @@ -1,12 +1,11 @@ -import { ApplicationConfig, provideBrowserGlobalErrorListeners<% if(!zoneless) { %>, provideZoneChangeDetection<% } %> } from '@angular/core';<% if (routing) { %> +import { ApplicationConfig, provideBrowserGlobalErrorListeners<% if (!zoneless) { %>, provideZoneChangeDetection<% } %> } from '@angular/core';<% if (routing) { %> import { provideRouter } from '@angular/router'; - import { routes } from './app.routes';<% } %> export const appConfig: ApplicationConfig = { providers: [ - provideBrowserGlobalErrorListeners(),<% if(!zoneless) { %> + provideBrowserGlobalErrorListeners(),<% if (!zoneless) { %> provideZoneChangeDetection({ eventCoalescing: true }),<% } %> - <% if (routing) {%>provideRouter(routes)<% } %> + <% if (routing) { %>provideRouter(routes)<% } %> ] }; diff --git a/packages/schematics/angular/application/files/standalone-files/src/app/app__suffix__.spec.ts.template b/packages/schematics/angular/application/files/standalone-files/src/app/app__suffix__.spec.ts.template index e6944dc73ccd..306911a0f500 100644 --- a/packages/schematics/angular/application/files/standalone-files/src/app/app__suffix__.spec.ts.template +++ b/packages/schematics/angular/application/files/standalone-files/src/app/app__suffix__.spec.ts.template @@ -5,7 +5,8 @@ describe('App', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [App], - }).compileComponents(); + }) + .compileComponents(); }); it('should create the app', () => { @@ -14,7 +15,7 @@ describe('App', () => { expect(app).toBeTruthy(); }); - it('should render title', <% if(zoneless) { %>async <% } %>() => { + it('should render title', <% if (zoneless) { %>async <% } %>() => { const fixture = TestBed.createComponent(App); <%= zoneless ? 'await fixture.whenStable();' : 'fixture.detectChanges();' %> const compiled = fixture.nativeElement as HTMLElement; diff --git a/packages/schematics/angular/application/files/standalone-files/src/app/app__suffix__.ts.template b/packages/schematics/angular/application/files/standalone-files/src/app/app__suffix__.ts.template index ce8010ecfbce..dfdb04abcb76 100644 --- a/packages/schematics/angular/application/files/standalone-files/src/app/app__suffix__.ts.template +++ b/packages/schematics/angular/application/files/standalone-files/src/app/app__suffix__.ts.template @@ -1,9 +1,11 @@ -import { Component, signal } from '@angular/core';<% if(routing) { %> +import { Component, signal } from '@angular/core';<% if (routing) { %> import { RouterOutlet } from '@angular/router';<% } %> @Component({ - selector: '<%= selector %>', - imports: [<% if(routing) { %>RouterOutlet<% } %>],<% if(inlineTemplate) { %> + imports: [<% if (routing) { %>RouterOutlet<% } %>], + selector: '<%= selector %>',<% if (inlineStyle) { %> + styles: [],<% } else { %> + styleUrl: './app<%= suffix %>.<%= style %>',<% } %><% if (inlineTemplate) { %> template: `<%= dasherize(name) %> works!
`,<% } else { %> - templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %><%= ngext %>.html',<% } if(inlineStyle) { %> - styles: `<% if(displayBlock){ %> - :host { - display: block; - } - <% } %>`,<% } else if (style !== 'none') { %> - styleUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.<%= style %>',<% } %><% if(!!viewEncapsulation) { %> - encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } if (changeDetection !== 'OnPush') { %> - changeDetection: ChangeDetectionStrategy.<%= changeDetection %>,<% } %> + templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %><%= ngext %>.html',<% } %> }) -export <% if(exportDefault) {%>default <%}%>class <%= classifiedName %> { - +export <% if (exportDefault) { %>default <% } %>class <%= classifiedName %> { } diff --git a/packages/schematics/angular/directive/files/__name@dasherize__.__type@dasherize__.ts.template b/packages/schematics/angular/directive/files/__name@dasherize__.__type@dasherize__.ts.template index eff23c7e350a..d932838b1f8e 100644 --- a/packages/schematics/angular/directive/files/__name@dasherize__.__type@dasherize__.ts.template +++ b/packages/schematics/angular/directive/files/__name@dasherize__.__type@dasherize__.ts.template @@ -1,8 +1,8 @@ import { Directive } from '@angular/core'; @Directive({ - selector: '[<%= selector %>]',<% if(!standalone) {%> - standalone: false,<%}%> + selector: '[<%= selector %>]',<% if (!standalone) { %> + standalone: false,<% } %> }) export class <%= classifiedName %> { } diff --git a/packages/schematics/angular/guard/implements-files/__name@dasherize____typeSeparator__guard.spec.ts.template b/packages/schematics/angular/guard/implements-files/__name@dasherize____typeSeparator__guard.spec.ts.template index fefa3afee2b0..0bea60fdd710 100644 --- a/packages/schematics/angular/guard/implements-files/__name@dasherize____typeSeparator__guard.spec.ts.template +++ b/packages/schematics/angular/guard/implements-files/__name@dasherize____typeSeparator__guard.spec.ts.template @@ -1,5 +1,4 @@ import { TestBed } from '@angular/core/testing'; - import { <%= classify(name) %>Guard } from './<%= dasherize(name) %><%= typeSeparator %>guard'; describe('<%= classify(name) %>Guard', () => { diff --git a/packages/schematics/angular/guard/type-files/__name@dasherize____typeSeparator__guard.spec.ts.template b/packages/schematics/angular/guard/type-files/__name@dasherize____typeSeparator__guard.spec.ts.template index 9bad0a553eb4..a9420dc90d56 100644 --- a/packages/schematics/angular/guard/type-files/__name@dasherize____typeSeparator__guard.spec.ts.template +++ b/packages/schematics/angular/guard/type-files/__name@dasherize____typeSeparator__guard.spec.ts.template @@ -1,6 +1,5 @@ import { TestBed } from '@angular/core/testing'; import { <%= guardType %> } from '@angular/router'; - import { <%= camelize(name) %>Guard } from './<%= dasherize(name) %><%= typeSeparator %>guard'; describe('<%= camelize(name) %>Guard', () => { diff --git a/packages/schematics/angular/interceptor/class-files/__name@dasherize____typeSeparator__interceptor.spec.ts.template b/packages/schematics/angular/interceptor/class-files/__name@dasherize____typeSeparator__interceptor.spec.ts.template index 9af595489571..b836eb209e36 100755 --- a/packages/schematics/angular/interceptor/class-files/__name@dasherize____typeSeparator__interceptor.spec.ts.template +++ b/packages/schematics/angular/interceptor/class-files/__name@dasherize____typeSeparator__interceptor.spec.ts.template @@ -1,5 +1,4 @@ import { TestBed } from '@angular/core/testing'; - import { <%= classify(name) %>Interceptor } from './<%= dasherize(name) %><%= typeSeparator %>interceptor'; describe('<%= classify(name) %>Interceptor', () => { diff --git a/packages/schematics/angular/interceptor/class-files/__name@dasherize____typeSeparator__interceptor.ts.template b/packages/schematics/angular/interceptor/class-files/__name@dasherize____typeSeparator__interceptor.ts.template index fffab4ddf988..427ddd774765 100755 --- a/packages/schematics/angular/interceptor/class-files/__name@dasherize____typeSeparator__interceptor.ts.template +++ b/packages/schematics/angular/interceptor/class-files/__name@dasherize____typeSeparator__interceptor.ts.template @@ -9,9 +9,6 @@ import { Observable } from 'rxjs'; @Injectable() export class <%= classify(name) %>Interceptor implements HttpInterceptor { - - constructor() {} - intercept(request: HttpRequest