终于我也要开始学习Angular(与ng-zorro)了【环境搭建篇】

从今天开始,我也成为了前端工程师。

创建 Angular 项目

$ git clone ほげほげ
$ cd ほげほげ/

または

$ mkdir angular-example
$ cd angular-example/

我假设这是从远程拉取或新建的目录,处于空白状态下写的。

根据 https://angular.io/guide/setup-local ,指定了要求的 Node 版本为 10.9.0 或更高版本。(截至2019年10月18日)

$ node -v
v10.16.1

好的!

$ npx @angular/cli new app --directory=. --style=styl --skipGit=true --routing=true --commit=false

https://angular.io/cli/new 的运行选项

我选择了stylus风格,除了它很时尚之外,没有其他选择的理由。

由于在初始化时,@angular/cli包已经包含在内,因此在以后使用ng命令时,可以使用npx ng 命令,以使用安装在本地的cli。

ng-zorro 的引入

$ npx ng add ng-zorro-antd
? Add icon assets [ Detail: https://ng.ant.design/components/icon/en ] No
? Set up custom theme file [ Detail: https://ng.ant.design/docs/customize-theme/en ] No
? Choose your locale code: ja_JP
? Choose template to create project: blank

确认行动

$ npx ng serve --open

这次到这里为止!解散!

广告
将在 10 秒后关闭
bannerAds