|
| 1 | +<docs-decorative-header title="Installation" imgSrc="adev/src/assets/images/what_is_angular.svg"> <!-- markdownlint-disable-line --> |
| 2 | +</docs-decorative-header> |
| 3 | + |
| 4 | +Get started with Angular quickly with online starters or locally with your terminal. |
| 5 | + |
| 6 | +## Play Online |
| 7 | + |
| 8 | +If you just want to play around with Angular in your browser without setting up a project, you can use our online sandbox: |
| 9 | + |
| 10 | +<docs-card-container> |
| 11 | + <docs-card title="" href="/playground" link="Open on Playground"> |
| 12 | + The fastest way to play with an Angular app. No setup required. |
| 13 | + </docs-card> |
| 14 | +</docs-card-container> |
| 15 | + |
| 16 | +## Setup a new project locally |
| 17 | + |
| 18 | +If you're starting a new project, you'll most likely want to create a local project so that you can use tooling such as Git. |
| 19 | + |
| 20 | +### Prerequisites |
| 21 | + |
| 22 | +- **Node.js** - v[^18.9.1 or newer](/reference/versions) |
| 23 | +- **Text editor** - We recommend [Visual Studio Code](https://code.visualstudio.com/) |
| 24 | +- **Terminal** - Required for running Angular CLI commands |
| 25 | + |
| 26 | +### Instructions |
| 27 | + |
| 28 | +The following guide will walk you through setting up a local Angular project. |
| 29 | + |
| 30 | +#### Install Angular CLI |
| 31 | + |
| 32 | +Open a terminal (if you're using [Visual Studio Code](https://code.visualstudio.com/), you can open an [integrated terminal](https://code.visualstudio.com/docs/editor/integrated-terminal)) and run the following command: |
| 33 | + |
| 34 | +<docs-code language="shell"> |
| 35 | + |
| 36 | +npm install -g @angular/cli |
| 37 | + |
| 38 | +</docs-code> |
| 39 | + |
| 40 | +If you are having issues running this command in Windows or Unix, check out the [CLI docs](/tools/cli/setup-local#install-the-angular-cli) for more info. |
| 41 | + |
| 42 | +#### Create a new project |
| 43 | + |
| 44 | +In your terminal, run the CLI command `ng new` with the desired project name. In the following examples, we'll be using the example project name of `my-first-angular-app`. |
| 45 | + |
| 46 | +<docs-code language="shell"> |
| 47 | + |
| 48 | +ng new <project-name> |
| 49 | + |
| 50 | +</docs-code> |
| 51 | + |
| 52 | +You will be presented with some configuration options for your project. Use the arrow and enter keys to navigate and select which options you desire. |
| 53 | + |
| 54 | +If you don't have any preferences, just hit the enter key to take the default options and continue with the setup. |
| 55 | + |
| 56 | +After you select the configuration options and the CLI runs through the setup, you should see the following message: |
| 57 | + |
| 58 | +```shell |
| 59 | +✔ Packages installed successfully. |
| 60 | + Successfully initialized git. |
| 61 | +``` |
| 62 | + |
| 63 | +At this point, you're now ready to run your project locally! |
| 64 | + |
| 65 | +#### Running your new project locally |
| 66 | + |
| 67 | +In your terminal, switch to your new Angular project. |
| 68 | + |
| 69 | +<docs-code language="shell"> |
| 70 | + |
| 71 | +cd my-first-angular-app |
| 72 | + |
| 73 | +</docs-code> |
| 74 | + |
| 75 | +All of your dependencies should be installed at this point (which you can verify by checking for the existent for a `node_modules` folder in your project), so you can start your project by running the command: |
| 76 | + |
| 77 | +<docs-code language="shell"> |
| 78 | + |
| 79 | +npm start |
| 80 | + |
| 81 | +</docs-code> |
| 82 | + |
| 83 | +If everything is successful, you should see a similar confirmation message in your terminal: |
| 84 | + |
| 85 | +```shell |
| 86 | +Watch mode enabled. Watching for file changes... |
| 87 | +NOTE: Raw file sizes do not reflect development server per-request transformations. |
| 88 | + ➜ Local: http://localhost:4200/ |
| 89 | + ➜ press h + enter to show help |
| 90 | +``` |
| 91 | + |
| 92 | +And now you can visit the path in `Local` (e.g., `http://localhost:4200`) to see your application. Happy coding! 🎉 |
| 93 | + |
| 94 | +## Next steps |
| 95 | + |
| 96 | +Now that you've created your Angular project, you can learn more about Angular in our [Essentials guide](/essentials) or choose a topic in our in-depth guides! |
0 commit comments