博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
My First Angular 2 App
阅读量:7095 次
发布时间:2019-06-28

本文共 3637 字,大约阅读时间需要 12 分钟。

hot3.png

  1. 创建目录angular2-app
  2. 添加tsconfig.json,typings.json,package.json
  3. cmd进入angular2-app,npm install
  4. angular2-app下创建app目录,添加app.compenent.ts,main.ts
  5. angular2-app下创建index.html
  6. angular2-app下,cmd运行:npm start

 tsconfig.json

{      "compilerOptions": {      "target": "es5",      "module": "system",      "moduleResolution": "node",      "sourceMap": true,      "emitDecoratorMetadata": true,      "experimentalDecorators": true,      "removeComments": false,      "noImplicitAny": false      },      "exclude": [      "node_modules",      "typings/main",      "typings/main.d.ts"      ]      }

typings.json

{      "ambientDependencies": {      "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2"      }      }

package.json

{      "name": "angular2-quickstart",      "version": "1.0.0",      "scripts": {      "start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",      "tsc": "tsc",      "tsc:w": "tsc -w",      "lite": "lite-server",      "typings": "typings",      "postinstall": "typings install"      },      "license": "ISC",      "dependencies": {      "angular2": "2.0.0-beta.7",      "systemjs": "0.19.22",      "es6-promise": "^3.0.2",      "es6-shim": "^0.33.3",      "reflect-metadata": "0.1.2",      "rxjs": "5.0.0-beta.2",      "zone.js": "0.5.15"      },      "devDependencies": {      "concurrently": "^2.0.0",      "lite-server": "^2.1.0",      "typescript": "^1.7.5",      "typings":"^0.6.8"      }      }

app.compenent.ts

System.register(['angular2/core'], function(exports_1, context_1) {      "use strict";      var __moduleName = context_1 && context_1.id;      var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;      return c > 3 && r && Object.defineProperty(target, key, r), r;      };      var __metadata = (this && this.__metadata) || function (k, v) {      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);      };      var core_1;      var AppComponent;      return {      setters:[      function (core_1_1) {      core_1 = core_1_1;      }],      execute: function() {      AppComponent = (function () {      function AppComponent() {      }      AppComponent = __decorate([      core_1.Component({      selector: 'my-app',      template: '

My First Angular 2 App

' }), __metadata('design:paramtypes', []) ], AppComponent); return AppComponent; }()); exports_1("AppComponent", AppComponent); } } });//# sourceMappingURL=app.component.js.map

main.ts

System.register(['angular2/platform/browser', './app.component'], function(exports_1, context_1) {      "use strict";      var __moduleName = context_1 && context_1.id;      var browser_1, app_component_1;      return {      setters:[      function (browser_1_1) {      browser_1 = browser_1_1;      },      function (app_component_1_1) {      app_component_1 = app_component_1_1;      }],      execute: function() {      browser_1.bootstrap(app_component_1.AppComponent);      }      }      });//# sourceMappingURL=main.js.map

index.html

Angular 2 QuickStart
Loading...

转载于:https://my.oschina.net/NeedLoser/blog/816483

你可能感兴趣的文章
加快普及智能家居DIY功能更受青睐
查看>>
python成长之路八 -- 内置函数
查看>>
【框架学习与探究之定时器--Quartz.Net 】
查看>>
Date 与 SimpleDateFormat
查看>>
C++ 11 创建和使用 unique_ptr
查看>>
文件的空间使用和IO统计
查看>>
软件产品评价
查看>>
2015 多校联赛 ——HDU5349(水)
查看>>
Golang的一些学习
查看>>
权谋残卷
查看>>
[网页游戏开发]使用编辑器制作界面
查看>>
BZOJ 2725: [Violet 6]故乡的梦
查看>>
BZOJ 4530: [Bjoi2014]大融合
查看>>
15年大神分享心得
查看>>
[POJ3169] Layout
查看>>
JAVA虚拟机:对象的创建过程
查看>>
《APUE》第五章笔记
查看>>
File控件杂谈
查看>>
动态调用webservice
查看>>
form表单post请求保护 隐藏秘钥
查看>>