Create Project with app.module.ts file
The solution to the issue where the .module.ts file was not created when launching a new project with Angular 17 has been found. The standalone mode is now the default in projects starting with Angular version 17. Therefore, if you start a new project without specifying anything, it will not have any modules.
Use the following command to create an application based on modules:
ng new geeks17 --no-standalone
Folder Structure
Dependencies
"dependencies": {
"@angular/animations": "^17.2.0",
"@angular/common": "^17.2.0",
"@angular/compiler": "^17.2.0",
"@angular/core": "^17.2.0",
"@angular/forms": "^17.2.0",
"@angular/platform-browser": "^17.2.0",
"@angular/platform-browser-dynamic": "^17.2.0",
"@angular/platform-server": "^17.2.0",
"@angular/router": "^17.2.0",
"@angular/ssr": "^17.2.0",
"express": "^4.18.2",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"
}
Example
<!--app.component.html-->
<h1>hello geeks for geeks {{title}}</h1>
//app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule, provideClientHydration } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [
provideClientHydration()
],
bootstrap: [AppComponent]
})
export class AppModule { }
//app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
export class AppComponent {
title = 'geeks17';
}
Output
Create Project with App Module in Angular 17
When you try to create the Angular 17 application, you notice that the app.module.ts file is missing. Angular 17 introduces a significant change with Standalone configuration as the default in projects. But if you still want to work with the old folder structure then follow this article to the end.
Contact Us