Creating an application in Angular 18
In this article we will look at creating a new Angular 18 application.
The Angular documentation advises installing ng globally:
angular.dev/tools/cli/setup-local#install-the-angular-cli
sudo npm install -g @angular/cli
After running the command:
ng new buy-and-fly
It is worth noting that there is no obvious need for this. You can use ng from the application itself, where you need to add yarn(npm) before launching.
To create a project, just npx is enough.
npx -p @angular/cli ng new buy-and-fly
Everything is the same without global CLI.
The following files were generated:
buy-and-fly ├── angular.json ├── package.json ├── package-lock.json ├── public │ └── favicon.ico ├── README.md ├── server.ts ├── src │ ├── app │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.config.server.ts │ │ ├── app.config.ts │ │ └── app.routes.ts │ ├── index.html │ ├── main.server.ts │ ├── main.ts │ └── styles.scss ├── tsconfig.app.json ├── tsconfig.json └── tsconfig.spec.json
For convenience, let's create a git flow:
git flow init
If you don't have the gitflow package, you can safely skip this step.
Let's create a new brunch:
git flow feature start config-workspace
Then delete package-lock.json:
rm package-lock.json
Since I prefer yarn, let's make the default yarn:
yarn set version stable
More information about yarn on the official website - yarnpkg.com
Since pnpm still causes problems, for simplicity we will use the standard nodeLinker:
yarn config set nodeLinker node-modules
Remove dependencies that were installed by npm:
rm -rf node_modules
In order not to bother choosing where to add new vendors, let's combine dependencies and devDependencies.
As a result, we get the following package.json:
{ "name": "buy-and-fly", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test", "serve:ssr:buy-and-fly": "node dist/buy-and-fly/server/server.mjs" }, "private": true, "devDependencies": { "@angular-devkit/build-angular": "^18.0.5", "@angular/animations": "^18.0.4", "@angular/cli": "^18.0.5", "@angular/common": "^18.0.4", "@angular/compiler": "^18.0.4", "@angular/compiler-cli": "^18.0.4", "@angular/core": "^18.0.4", "@angular/forms": "^18.0.4", "@angular/platform-browser": "^18.0.4", "@angular/platform-browser-dynamic": "^18.0.4", "@angular/platform-server": "^18.0.4", "@angular/router": "^18.0.4", "@angular/ssr": "^18.0.5", "@types/express": "^4.17.21", "@types/jasmine": "~5.1.4", "@types/node": "^20.14.8", "express": "^4.19.2", "jasmine-core": "~5.1.2", "karma": "~6.4.3", "karma-chrome-launcher": "~3.2.0", "karma-coverage": "~2.2.1", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", "rxjs": "~7.8.1", "tslib": "^2.6.3", "typescript": "~5.4.5", "zone.js": "~0.14.7" }, "packageManager": "yarn@4.3.1" }
Exclude generated files in .gitignore from the repository:
# Custom .yarn .angular *.patch .husky/* junit.xml /junit .env package-lock.json yarn.lock .nx src/i18n/source.xlf
Install dependencies:
yarn
Add changes to git:
git add .
Commit:
git commit -m “[workspace] Change package manager”
In the next article we will configure linters and IDEs.
Links
All sources are on github, in the repository - github.com/Fafnur/buy-and-fly
You can watch the demo here - buy-and-fly.fafn.ru/
My groups: telegram, medium, vk, x.com, linkedin, site
The above is the detailed content of Creating an application in Angular 18. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.

Learning JavaScript is not difficult, but it is challenging. 1) Understand basic concepts such as variables, data types, functions, etc. 2) Master asynchronous programming and implement it through event loops. 3) Use DOM operations and Promise to handle asynchronous requests. 4) Avoid common mistakes and use debugging techniques. 5) Optimize performance and follow best practices.

Discussion on the realization of parallax scrolling and element animation effects in this article will explore how to achieve similar to Shiseido official website (https://www.shiseido.co.jp/sb/wonderland/)...

How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...
