官术网_书友最值得收藏!

Generating our Angular project scaffold

In this section, we are going to learn how to set up a new project that follows Angular's development practices. Let's get started:

  1. Run the following commands to generate a new Angular project called integrate-angular:
      ng new integrate-angular
cd integrate-angular

The Angular CLI tool usually asks a series of questions to clarify what extra features you want to have in the resulting application.

  1. If you're asked about routing support, type Y and press Enter:
      Would you like to add Angular routing? (y/N)
Y
  1. Next, if the tool asks you about the stylesheet format, choose SCSS, as shown in the following code:
      Which stylesheet format would you like to use? (Use arrow keys)
SCSS
  1. The output of the preceding code is as follows:

Note how the Angular CLI generates a set of files for you. The tool provides you with various ignore rules for NPM and Git inside the .gitignore file, configuration files for Typescript and the Karma test runner, and even a set of unit and end-to-end tests as part of the initial scaffold.

  1. Check out what the package.json file looks like, especially its general information and the scripts section:
      {
"name": "integrate-angular",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
}

  1. The Angular CLI also performs dependency library installation, so all you need to do is run the following command to get your web application up and running:
      npm start

Historically, every web app that we generate with the help of the Angular CLI runs on port 4200 by default. You can quickly change the port in the future, but for now let's stick to the defaults.

  1. Launch your preferred browser and navigate to http://locahost:4200. You should see a landing page called Welcome to integrate-angular! that the Angular CLI has created for you:

Now, let's configure the Electron shell so that it works with Angular code.

主站蜘蛛池模板: 星子县| 子洲县| 汉源县| 额尔古纳市| 通州市| 远安县| 晴隆县| 治多县| 河曲县| 武隆县| 无棣县| 保靖县| 含山县| 鹤岗市| 平泉县| 汉阴县| 上林县| 宁海县| 夹江县| 吉安市| 西乌珠穆沁旗| 阳东县| 青州市| 常熟市| 伊宁市| 永顺县| 宁武县| 吴川市| 余庆县| 杭州市| 襄垣县| 阳山县| 威宁| 张家港市| 山东| 固始县| 客服| 上饶县| 江华| 临邑县| 昌黎县|