angular2教程例子配置文件
2017-06-29 23:17
127 查看
angular2教程例子配置文件
学习angular2官方文档的《路由与导航》一节时下载的例子缺少配置文件,npm start无法运行程序,在router目录下添加如下两个文件即可。1. bs-config.json
{ "server": { "baseDir": "src", "routes": { "/node_modules": "node_modules" } } }
2. typings.json
{ "globalDependencies": { "core-js": "registry:dt/core-js#0.0.0+20160725163759", "jasmine": "registry:dt/jasmine#2.2.0+20160621224255", "node": "registry:dt/node#6.0.0+20160909174046" } }
添加完毕后文件目录结构应该是下面这样:
C:. │ bs-config.json │ package.json │ typings.json │ └─src │ index.html │ main.ts │ systemjs-angular-loader.js │ systemjs.config.js │ tsconfig.json │ └─app │ animations.ts │ app-routing.module.ts │ app.component.ts │ app.module.ts │ auth-guard.service.ts │ auth.service.ts │ can-deactivate-guard.service.ts │ compose-message.component.html │ compose-message.component.ts │ dialog.service.ts │ login-routing.module.ts │ login.component.ts │ not-found.component.ts │ selective-preloading-strategy.ts │ ├─admin │ admin-dashboard.component.ts │ admin-routing.module.ts │ admin.component.ts │ admin.module.ts │ manage-crises.component.ts │ manage-heroes.component.ts │ ├─crisis-center │ crisis-center-home.component.ts │ crisis-center-routing.module.ts │ crisis-center.component.ts │ crisis-center.module.ts │ crisis-detail-resolver.service.ts │ crisis-detail.component.ts │ crisis-list.component.ts │ crisis.service.ts │ └─heroes hero-detail.component.ts hero-list.component.ts hero.service.ts heroes-routing.module.ts heroes.module.ts
3. npm install
4. npm start
若是npm start失败,还可能需要安装下面两个库:
npm install phantomjs-prebuilt@2.1.14
npm install @angular/animations@4.0.3
根据命令行提示缺少的库进行安装。
npm start 运行即可
5. 虽然工程可以运行,但是你发现样式似乎不对,在src目录下添加styles.css文件,内容从在线例子上拷贝下来即可。
相关文章推荐
- 体验Castle中从配置文件注册组件以及传递参数的一个小例子
- vs2005视频教程 之 用户管理 配置文件 [视频]
- MySQL配置文件my.cnf 例子最详细翻译
- MySQL 配置文件my.cnf 例子最详细翻译
- MySQL 配置文件my.cnf 例子最详细翻译
- 读取配置文件的例子
- MySQL配置文件my.cnf 例子最详细翻译[转]
- Struts1.x系列教程(24):配置文件总结
- Struts1.x系列教程(24):配置文件总结
- MySQL配置文件my.cnf(my.ini) 例子最详细翻译
- MySQL配置文件my.cnf 例子最详细翻译,可以保存做笔记用。 (转)
- 一个 .emacs 配置文件的例子
- struts简单例子的分析(含代码注释和配置文件说明)
- stl读取ini配置文件例子
- mangos新手教程 - 服务器配置文件中文说明
- Python读取XML配置文件小例子
- 读取NET2.0的配置文件例子-configuration
- java中经常用到的读写配置文件的信息properties属性的写入,读取例子
- MRTG教程(二):MRTG配置文件的生成工具cfgmaker(上)
- struts简单例子的分析(含代码注释和配置文件说明)