Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning Angular

You're reading from   Learning Angular A practical guide to building web applications with modern Angular

Arrow left icon
Product type Paperback
Published in Jan 2025
Publisher Packt
ISBN-13 9781835087480
Length 486 pages
Edition 5th Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Aristeidis Bampakos Aristeidis Bampakos
Author Profile Icon Aristeidis Bampakos
Aristeidis Bampakos
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Building Your First Angular Application 2. Introduction to TypeScript FREE CHAPTER 3. Structuring User Interfaces with Components 4. Enriching Applications Using Pipes and Directives 5. Managing Complex Tasks with Services 6. Reactive Patterns in Angular 7. Tracking Application State with Signals 8. Communicating with Data Services over HTTP 9. Navigating through Applications with Routing 10. Collecting User Data with Forms 11. Handling Application Errors 12. Introduction to Angular Material 13. Unit Testing Angular Applications 14. Bringing Applications to Production 15. Optimizing Application Performance 16. Index

Getting started with TypeScript

The TypeScript language is an npm package that can be installed from the npm registry using the following command:

npm install -g typescript

In the preceding command, we chose to install TypeScript globally in our system so that we can use it from any path in our development environment. Let's see how we can use TypeScript using a simple example:

  1. Open VSCode and select File | New File… from the main menu options.
  2. Enter app.ts in the New File… dialog and press Enter.

    Figure 2.1: New file dialog
  3. As we have already learned, TypeScript files have a .ts extension.
  4. Use the dialog that opens to create the new file. VSCode will open the file inside the editor.
  5. Type the following snippet into the app.ts file:
const title = 'Hello TypeScript!';
  1. Although we have created a TypeScript file, the preceding snippet is valid JavaScript code. Recall that TypeScript is a superset of JavaScript that provides syntactic sugar through its...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime