Angular-hello world

环境搭建- 安装angular-cli

用npm安装typescript和typings

npm install -gtypescript typings

安装angular-cl

npm install -gangular-cli@latest

ngnew ProjectName //ProjectName为你的项目名,用此命令建立基本文件,然后强制终止

cd ProjectName

cnpm install //下载node-modules库

ngserve // 启动项目

接下来在浏览器输入http://localhost:4200

PS:使用npm默认从国外网站下载资源,cnpm默认从国内网站下载资源。

angular-cli创建基本文件:

angular-cli.json是angular-cli的配置文件,

测试配置文件karma.conf.js

typescript的lint配置文件

端到端的测试配置文件protractor.conf.js

导入es6模块的配置文件polyfills.ts

angular工程的main.ts引导启动文件

全局样式style.css

typescript配置文件ts.config.json;

typescript的声明文件typings.d.ts

angular组建app.components相关的css,html,ts

这些配置都是angular2的生产项目中需要配置的文件

关键点:

1.添加组件Component

ng g component home

ng g component about

2.添加模块Module

PS:默认下载到G:\Angular2研究\angular-cli-login\src\app

ng g modulehome

ng g module about

相关推荐
举个栗子dhy几秒前
第四章、路由配置
前端·javascript·react.js
XiaoYu20021 分钟前
AI精准提问手册:从模糊需求到精准输出的核心技能(上)
前端·人工智能·程序员
东华帝君1 分钟前
vue3组件通信
前端
windliang2 分钟前
前端 AI 自动化测试:brower-use 调研
前端·agent·测试
用户84298142418104 分钟前
Node.js:JavaScript的服务器端革命
javascript
小高0077 分钟前
instanceof 和 typeof 的区别:什么时候该用哪个?
前端·javascript·面试
im_AMBER8 分钟前
React 03
前端·笔记·学习·react.js·前端框架·react
over6978 分钟前
从代码到歌词:我用AI为汪峰创作了一首情歌
前端
老前端的功夫9 分钟前
JavaScript的`this`指向:送你一张永远不会错的地图
前端
前端没钱9 分钟前
Tauri2+vue3+NaiveUI仿写windows微信,安装包仅为2.5M,95%的API用JavaScript写,太香了
前端·vue.js·rust