欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

詳解.Net Core + Angular2 環(huán)境搭建

 更新時(shí)間:2016年12月03日 10:21:27   作者:xiaoxiaoii  
這篇文章主要介紹了詳解.Net Core + Angular2 環(huán)境搭建,具有一定的參考價(jià)值,有興趣的可以了解一下。

本文介紹了.Net Core + Angular2 環(huán)境搭建,具體如下:

環(huán)境搭建:

1)node.js版本>5.0,NPM版本>3.0,TypeScript版本>2.0(全裝最新版就好了)

2)安裝NTVS 1.2(node tools for vs),TSVS dev 1.4(TS for VS)

3)構(gòu)建package.json,tsconfig.json,gulp.js文件

1、package.json

{
 "name": "template.angular2",
 "version": "1.0.0",
 "licenses": [
  {
   "type": "MIT",
   "url": "https://github.com/angular/angular.io/blob/master/LICENSE"
  }
 ],
 "dependencies": {
  "@angular/common": "~2.1.1",
  "@angular/compiler": "~2.1.1",
  "@angular/core": "~2.1.1",
  "@angular/forms": "~2.1.1",
  "@angular/http": "~2.1.1",
  "@angular/platform-browser": "~2.1.1",
  "@angular/platform-browser-dynamic": "~2.1.1",
  "@angular/router": "~3.1.1",
  "@angular/upgrade": "~2.1.1",
  "core-js": "^2.4.1",
  "reflect-metadata": "^0.1.8",
  "rxjs": "5.0.0-beta.12",
  "systemjs": "0.19.39",
  "zone.js": "^0.6.25"
 },
 "devDependencies": {
  "@types/core-js": "^0.9.34",
  "@types/node": "^6.0.45",
  "gulp": "^3.9.1",
  "del": "^2.2.2"
 }
}

2、tsconfig.json

{
 "compilerOptions": {
  "target": "es5",
  "module": "commonjs",
  "moduleResolution": "node",
  "sourceMap": true,
  //需要這個(gè)才能使用注釋器
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
  "removeComments": false,
  "noImplicitAny": false
 },
 "compileOnSave": true
}

3、gulp.js

var gulp = require('gulp');
var del = require('del');

var paths = {
  angularPatch: [
    "node_modules/core-js*/**/*",
    "node_modules/zone.js*/**/*",
    "node_modules/reflect-metadata*/*.js",
     "node_modules/reflect-metadata*/*.map",
    "node_modules/systemjs*/dist*/*.js",
     "node_modules/systemjs*/dist*/*.map"
  ],
  angularSrc: [
    "node_modules/@angular/core/bundles/core.umd.js",
    "node_modules/@angular/common/bundles/common.umd.js",
    "node_modules/@angular/compiler/bundles/compiler.umd.js",
    "node_modules/@angular/platform-browser/bundles/platform-browser.umd.js",
    "node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js",
    "node_modules/@angular/http/bundles/http.umd.js",
    "node_modules/@angular/router/bundles/router.umd.js",
    "node_modules/@angular/forms/bundles/forms.umd.js",
    "node_modules/@angular/upgrade/bundles/upgrade.umd.js"
    //"node_modules/",
  ],
  rxjsSrc: "node_modules/rxjs/**/*",
  TSSrc:"Scripts/**/*.js",
  TSTarget:"wwwroot/js",
  Tartget:"wwwroot/lib"
}
//手工構(gòu)建一次
gulp.task("copyangularfiles", function () {
  //gulp.src(paths.angularSrc).pipe(gulp.dest(paths.Tartget));

  paths.angularSrc.forEach(function (path) {
    var tpath = path.replace("node_modules", paths.Tartget).split('/');
    gulp.src(path).pipe(gulp.dest(tpath.slice(0, tpath.length - 1).join('/')));
  });
  gulp.src(paths.rxjsSrc).pipe(gulp.dest(paths.Tartget + "/rxjs"));
  gulp.src(paths.angularPatch).pipe(gulp.dest(paths.Tartget + "/patch"));

});
//加入任務(wù)->綁定->生成前
gulp.task("copytsfiles", function () {
  gulp.src(paths.TSSrc).pipe(gulp.dest(paths.TSTarget));
})

gulp.task('default', ['copytsfiles'], function () {
  // place code for your default task here
});

4)在項(xiàng)目根目錄建立 Scripts 文件夾

5)在wwwroot文件夾建立systemjs.config.js

/**
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'lib/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      app: 'js',
      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
      '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
      // other libraries
      'rxjs': 'npm:rxjs'
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.js',
        defaultExtension: 'js'
      },
      rxjs: {
        defaultExtension: 'js'
      }
    }
  });
})(this);

6)修改Views/Shared/_Layout.cshtml,刪除對(duì)site.js的引用

7)修改Views/Home/Index.cshtml,增加/構(gòu)建@section scripts 腳本段

@section scripts{

  <!-- 1. Load libraries -->
  <!-- Polyfill(s) for older browsers -->

  <script src="~/lib/patch/core-js/client/shim.min.js"></script>

  <script src="~/lib/patch/zone.js/dist/zone.js"></script>

  <script src="~/lib/patch/reflect-metadata/Reflect.js"></script>

  <script src="~/lib/patch/systemjs/dist/system.src.js"></script>
  <!-- 2. Configure SystemJS -->

  <script src="systemjs.config.js"></script>

  <script>
    System.import('app').catch(function (err) { console.error(err); });
  </script>

}

8)環(huán)境搭建完成,程序入口文件 wwwroot/js/main.js(Scripts/main.ts)

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Entity Framework中執(zhí)行sql語(yǔ)句

    Entity Framework中執(zhí)行sql語(yǔ)句

    這篇文章介紹了Entity Framework中執(zhí)行sql語(yǔ)句的方法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-03-03
  • .NET Core讀取配置文件方式詳細(xì)總結(jié)

    .NET Core讀取配置文件方式詳細(xì)總結(jié)

    這篇文章主要為大家詳細(xì)總結(jié)了.NET Core讀取配置文件方式,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-08-08
  • .Net Core學(xué)習(xí)教程之在Mvc中簡(jiǎn)單的使用日志組件

    .Net Core學(xué)習(xí)教程之在Mvc中簡(jiǎn)單的使用日志組件

    這篇文章主要給大家介紹了關(guān)于.Net Core學(xué)習(xí)教程之在Mvc中簡(jiǎn)單使用日志組件的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2018-06-06
  • 國(guó)產(chǎn)化之銀河麒麟安裝.NetCore包管理器方式(步驟詳解)

    國(guó)產(chǎn)化之銀河麒麟安裝.NetCore包管理器方式(步驟詳解)

    這篇文章主要介紹了國(guó)產(chǎn)化之銀河麒麟安裝.NetCore-包管理器方式,本文給大家分享安裝步驟及安裝命令,對(duì)銀河麒麟安裝.NetCore相關(guān)知識(shí)感興趣的朋友一起看看吧
    2022-03-03
  • asp.net錯(cuò)誤捕獲(錯(cuò)誤處理)page_error事件使用方法

    asp.net錯(cuò)誤捕獲(錯(cuò)誤處理)page_error事件使用方法

    Page_Error事件提供了一種捕獲頁(yè)面級(jí)錯(cuò)誤的方法。對(duì)于錯(cuò)誤的處理,您可以只是顯示錯(cuò)誤信息(正如下面的示例代碼所示),也可以記錄事件或執(zhí)行某個(gè)其他操作
    2014-01-01
  • ASPX向ASCX傳值以及文本創(chuàng)建圖片(附源碼)

    ASPX向ASCX傳值以及文本創(chuàng)建圖片(附源碼)

    把用戶在TextBox輸入的文字創(chuàng)建為一個(gè)圖片,ASCX的ImageButton的ImageUrl重新指向這剛產(chǎn)生的圖片,接下來(lái)介紹下ASPX向ASCX傳值,感興趣的朋友可以參考下哈
    2013-03-03
  • C# 命名規(guī)則(挺不錯(cuò)的)

    C# 命名規(guī)則(挺不錯(cuò)的)

    我自己總結(jié)的一套命名規(guī)則,其實(shí)規(guī)則很重要,它是一種標(biāo)準(zhǔn),可有可無(wú),但有總會(huì)比無(wú)好,大家正在編碼的同志仔細(xì)看看,給點(diǎn)改進(jìn)意見(jiàn)。
    2009-02-02
  • Asp.net 頁(yè)面導(dǎo)航的幾種方法與比較 分享

    Asp.net 頁(yè)面導(dǎo)航的幾種方法與比較 分享

    在ASP.NET應(yīng)用中,Web表單之間的導(dǎo)航有多種方式:用超級(jí)鏈接,用Response.Redirect,用Server.Transfer,或者用Server.Execute。本文將分析這四種導(dǎo)航方式的異同及其優(yōu)缺點(diǎn),幫助你選擇最佳的導(dǎo)航方式。
    2013-07-07
  • ASP.NET Core中使用MialKit實(shí)現(xiàn)郵件發(fā)送功能

    ASP.NET Core中使用MialKit實(shí)現(xiàn)郵件發(fā)送功能

    這篇文章主要介紹了ASP.NET Core中使用MialKit實(shí)現(xiàn)郵件發(fā)送功能,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-10-10
  • ASP.NET中JQuery+AJAX調(diào)用后臺(tái)

    ASP.NET中JQuery+AJAX調(diào)用后臺(tái)

    這篇文章主要介紹了ASP.NET中JQuery+AJAX調(diào)用后臺(tái)的相關(guān)資料,需要的朋友可以參考下
    2016-03-03

最新評(píng)論