成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

angular入門(mén)

Yangder / 3517人閱讀

摘要:學(xué)習(xí)入門(mén)第一課步驟創(chuàng)建應(yīng)用程序的項(xiàng)目文件夾和定義包的依賴關(guān)系和特殊項(xiàng)目設(shè)置文件創(chuàng)建文件編譯

angular2 學(xué)習(xí)入門(mén)第一課 步驟

Install Node.js

創(chuàng)建應(yīng)用程序的項(xiàng)目文件夾和定義包的依賴關(guān)系和特殊項(xiàng)目設(shè)置

Create the app’s Angular root component

Add main.ts, identifying the root component to Angular

Add index.html, the web page that hosts the application

Build and run the app

文件 創(chuàng)建文件
touch package.json
touch tsconfig.json 
touch typings.json
touch systemjs.config.js
touch index.html
touch styles.css
mkdir app
touch app/app.component.ts
touch app/main.ts
 package.json
 
{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently "npm run tsc:w" "npm run lite" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.4",
    "systemjs": "0.19.27",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12",
    "angular2-in-memory-web-api": "0.0.14",
    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings":"^1.0.4"
  }
}
tsconfig.json 

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  }
}
typings.json

{
  "globalDependencies": {
    "core-js": "registry:dt/core-js#0.0.0+20160602141332",
    "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
    "node": "registry:dt/node#6.0.0+20160621231320"
  }
}
systemjs.config.js

/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function(global) {
  // map tells the System loader where to look for things
  var map = {
    "app":                        "app", // "dist",
    "@angular":                   "node_modules/@angular",
    "angular2-in-memory-web-api": "node_modules/angular2-in-memory-web-api",
    "rxjs":                       "node_modules/rxjs"
  };
  // packages tells the System loader how to load when no filename and/or no extension
  var packages = {
    "app":                        { main: "main.js",  defaultExtension: "js" },
    "rxjs":                       { defaultExtension: "js" },
    "angular2-in-memory-web-api": { main: "index.js", defaultExtension: "js" },
  };
  var ngPackageNames = [
    "common",
    "compiler",
    "core",
    "forms",
    "http",
    "platform-browser",
    "platform-browser-dynamic",
    "router",
    "router-deprecated",
    "upgrade",
  ];
  // Individual files (~300 requests):
  function packIndex(pkgName) {
    packages["@angular/"+pkgName] = { main: "index.js", defaultExtension: "js" };
  }
  // Bundled (~40 requests):
  function packUmd(pkgName) {
    packages["@angular/"+pkgName] = { main: "/bundles/" + pkgName + ".umd.js", defaultExtension: "js" };
  }
  // Most environments should use UMD; some (Karma) need the individual index files
  var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
  // Add package entries for angular packages
  ngPackageNames.forEach(setPackageConfig);
  var config = {
    map: map,
    packages: packages
  };
  System.config(config);
})(this);
編譯
npm install
npm run typings install
Our first Angular component
mkdir app

touch app/app.component.ts

import { Component } from "@angular/core";
@Component({
  selector: "my-app",
  template: "

My First Angular 2 App

" }) export class AppComponent { } touch app/main.ts import { bootstrap } from "@angular/platform-browser-dynamic"; import { AppComponent } from "./app.component"; bootstrap(AppComponent); touch index.html

  
    Angular 2 QuickStart
    
    
    
    
     
    
    
    
    
    
    
    
  
  
  
    Loading...
  

style.css

h1 {
  color: #369;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 250%;
}
body {
  margin: 2em;
}
Build and run the app!
npm start

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/80030.html

相關(guān)文章

  • Angular AMD 快速入門(mén)

    摘要:快速入門(mén)是作者使用開(kāi)發(fā)的前端框架因此你可以使用它快速創(chuàng)建一款它特別適合快速開(kāi)發(fā)應(yīng)用。配置路由通過(guò)使用我們可以動(dòng)態(tài)配置所需要加載的主要目的是去設(shè)置中去進(jìn)行惰性加載以及無(wú)論你傳入什么樣的參數(shù)值進(jìn)去,都會(huì)被返回。 Angular AMD 快速入門(mén) angularAMD是作者@ marcoslin使用 RequireJS + AngularJS開(kāi)發(fā)的前端mvvm框架,因此你可以使用它快速創(chuàng)建一...

    Tychio 評(píng)論0 收藏0
  • Angular2入門(mén)系列(三)————組件

    摘要:入門(mén)系列三組件概述組件是構(gòu)成應(yīng)用的基礎(chǔ)和核心,它是用來(lái)包裝特定的功能,應(yīng)用程序的有序運(yùn)行依賴于組件之間的協(xié)同工作。在早期的模塊化工具中,多數(shù)只是針對(duì)文件部分做了處理,比如,而缺少對(duì),等文件進(jìn)行管理的工具。組件的詳細(xì)介紹請(qǐng)見(jiàn)下一章節(jié)。。。 Angular2入門(mén)系列(三)————組件 1. 概述 組件(component)是構(gòu)成Angular應(yīng)用的基礎(chǔ)和核心,它是用來(lái)包裝特定的功能,應(yīng)用程...

    denson 評(píng)論0 收藏0
  • Angular2入門(mén)系列(一)————如何在Angular2中使用jQuery和基于jQuery的插

    摘要:入門(mén)系列一如何在中使用和基于的插件在年的月中旬,官方終于正式發(fā)布。本篇文章就簡(jiǎn)單介紹下在中如何使用極其插件。按照插件的使用規(guī)則,在對(duì)應(yīng)的中使用插件所需要的結(jié)構(gòu)。 Angular2入門(mén)系列(一)————如何在Angular2中使用jQuery和基于jQuery的插件 在2016年的9月中旬,Google官方終于正式發(fā)布Angular2。盡管npm社區(qū)越來(lái)越完善,也提供了大量的插件,但是基...

    Karrdy 評(píng)論0 收藏0
  • Angular2入門(mén)系列(一)————如何在Angular2中使用jQuery和基于jQuery的插

    摘要:入門(mén)系列一如何在中使用和基于的插件在年的月中旬,官方終于正式發(fā)布。本篇文章就簡(jiǎn)單介紹下在中如何使用極其插件。按照插件的使用規(guī)則,在對(duì)應(yīng)的中使用插件所需要的結(jié)構(gòu)。 Angular2入門(mén)系列(一)————如何在Angular2中使用jQuery和基于jQuery的插件 在2016年的9月中旬,Google官方終于正式發(fā)布Angular2。盡管npm社區(qū)越來(lái)越完善,也提供了大量的插件,但是基...

    z2xy 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<