<a href="{{url}}">{{ title }}</a>
ts部分
export class InterpolationComponent implements OnInit {
title = "{{內嵌繫結}}";
url = "http://tw.yahoo.com";
constructor() {
}
ngOnInit(): void {
}
}
參考資料1.保哥的Angular 開發實戰:從零開始
2.Angular官網
<a href="{{url}}">{{ title }}</a>
ts部分
export class InterpolationComponent implements OnInit {
title = "{{內嵌繫結}}";
url = "http://tw.yahoo.com";
constructor() {
}
ngOnInit(): void {
}
}
參考資料ctrl + `(單引號,通常在1的左邊tab上面)2.按+號新增終端機,預設可能是power shell,選擇終端機資料夾預設應該會在目前的專案上
ng generate component pages ng generate 建立一個 簡寫 g component 哪一種範本 簡寫 cpages 頁面名稱 未來請輸入方式如下列 ng g c pages
ng g -h 可看目前版本所有可建立的範本4.建立起來後,會多一個資料夾及有四個檔案,然後app.module.ts 會異動
CREATE src/app/pages/pages.component.html (24 bytes) <-Html
CREATE src/app/pages/pages.component.spec.ts (621 bytes) <-測試檔
CREATE src/app/pages/pages.component.ts (265 bytes) <-程式
CREATE src/app/pages/pages.component.css (0 bytes) <-css
UPDATE src/app/app.module.ts (392 bytes) 修改了declarations
及import { PagesComponent } from './pages/pages.component';
5.如何顯示這個頁面?<app-pages></app-pages>參考資料
npm start以下是已專案預設的程式跑起來的順序
cd\ d: md projects cd projects ng new firstapp3.測試是否有建置成功,至剛新增的資料夾使用npm
cd firstapp npm start4.開啟瀏覽器看看網站是否有成功,有跑起來會有Welcome to app!
http://localhost:4200/5.如何發佈
一般 ng build 加參數--prod ng build --prod 壓縮整的專案js變小===============================================================
找到package.json "start": "ng serve" 改 "start": "ng serve --port 8080"B.如何關閉npm Server
ctrl + c yC.開啟VS Code,在專案下輸入
code .D.如果Angular版本更新了要如何升級
專案目錄下 ng update會出現以下表示升級完成
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------------------------
@angular/cli 1.2.3 -> 6.0.2 ng update @angular/cli
@angular/core 4.4.7 -> 6.0.2 ng update @angular/core
rxjs 5.5.10 -> 6.1.0 ng update rxjs
There might be additional packages that are outdated.
Or run ng update --all to try to update all at the same time.
E.以述為單一專案升級,升級Global Agnular Cli版本方式看目前版本 npm list -g --depth=0 檢查最新版本 npm outdated -g 沒出現文字為目前最新版 有出現代表有新版 Package Current Wanted Latest Location @angular/cli 6.0.1 6.0.3 6.0.3 若有新版可執行下列安裝最新版 npm install -g @angular/cli===============================================================
shift + alt + f2.ts html 快速切換
alt + o3.註解
ctrl + /===============================================================
npm -v node -v4.安裝angular cli開啟命令提示字元
npm install -g @angular/cli ng -v如有安裝錯誤可輸入依序
npm uninstall -g angular-cli npm uninstall -g @angular/cli npm cache clean npm install -g @angular/cli參考資料
if (file != null && file.Count() > 0)
{
foreach (var item in file)
{
if (item != null)
{
//轉成圖片
System.Drawing.Image img = System.Drawing.Image.FromStream(item.InputStream);
//取得旋轉度數
foreach (var prop in img.PropertyItems)
{
if (prop.Id == 0x0112) //value of EXIF
{
int orientationValue = img.GetPropertyItem(prop.Id).Value[0];
RotateFlipType rotateFlipType = GetOrientationToFlipType(orientationValue);//取得轉的度數
img.RotateFlip(rotateFlipType);//依度數轉成正的
break;
}
}
//處理圖片 轉二進位 或存到路徑上
//byte[] byteImage = imageToByteArray(img);//轉二進位
//img.Save.....
}
}
}
public static RotateFlipType GetOrientationToFlipType(int orientationValue)
{
RotateFlipType rotateFlipType = RotateFlipType.RotateNoneFlipNone;
switch (orientationValue)
{
case 1:
rotateFlipType = RotateFlipType.RotateNoneFlipNone;
break;
case 2:
rotateFlipType = RotateFlipType.RotateNoneFlipX;
break;
case 3:
rotateFlipType = RotateFlipType.Rotate180FlipNone;
break;
case 4:
rotateFlipType = RotateFlipType.Rotate180FlipX;
break;
case 5:
rotateFlipType = RotateFlipType.Rotate90FlipX;
break;
case 6:
rotateFlipType = RotateFlipType.Rotate90FlipNone;
break;
case 7:
rotateFlipType = RotateFlipType.Rotate270FlipX;
break;
case 8:
rotateFlipType = RotateFlipType.Rotate270FlipNone;
break;
default:
rotateFlipType = RotateFlipType.RotateNoneFlipNone;
break;
}
return rotateFlipType;
}
參考來源<div id="status" style="background-image: url(image/123.gif)"></div>如果需要做可以動態改變時怎麼辦
<div id="status" style="background-image: url(@Url.Action("Index" , "images")/status.gif)"></div>
使用@Url.Action來產生連結這樣就可做多種變化this.KeyPreview = true;2.覆寫Form.ProcessCmdKey大致上這樣就可以了
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.NumPad1:
case Keys.D1:
//按下1或鍵盤1時處理
return true;
case Keys.Enter:
//按下Enter時處理
return true;
case Keys.Escape:
//按下Esc時處理
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
參考來源1.把連線字串名稱改掉 2.<remove name="ConnectionString" />參考來源
.Net Framework Install-Package Autofac.Mvc5 -Version 4.0.2 Install-Package bootstrap -Version 3.3.7 Install-Package EntityFramework -Version 6.2.0 Install-Package EntityFramework.zh-Hant -Version 6.2.0 Install-Package Fancybox -Version 2.1.5 Install-Package jQuery -Version 1.12.4 Install-Package Microsoft.jQuery.Unobtrusive.Ajax -Version 3.2.5 Install-Package Newtonsoft.Json -Version 7.0.1 Install-Package NPOI -Version 2.4.0 Install-Package PagedList.Mvc -Version 4.5.0 Install-Package System.Linq.Dynamic -Version 1.0.7 Install-Package Microsoft.AspNet.Mvc -Version 5.2.7
.Net Core(2020-11-13) Model Install-Package FluentValidation.AspNetCore Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 3.1.21 Install-Package Microsoft.EntityFrameworkCore.SqlServer.Design Install-Package Microsoft.EntityFrameworkCore.Tools -Version 3.1.21 Service Install-Package Dapper Install-Package Microsoft.AspNetCore.Mvc.Core Install-Package NPOI -Version 2.5.2 Web Install-Package X.PagedList.Mvc.Corelibman.json(2020-11-13)
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"provider": "unpkg",
"library": "@microsoft/signalr@3.1.4",
"destination": "wwwroot/microsoft/signalr/"
},
{
"library": "fancybox@3.5.7",
"destination": "wwwroot/lib/fancybox/"
},
{
"library": "jquery@3.5.1",
"destination": "wwwroot/lib/jquery/"
},
{
"provider": "unpkg",
"library": "bootstrap@4.5.3",
"destination": "wwwroot/lib/bootstrap/"
},
{
"library": "bootstrap-datepicker@1.9.0",
"destination": "wwwroot/lib/bootstrap-datepicker/"
}
]
}
@using (Ajax.BeginForm("action", "controller", null, new AjaxOptions { HttpMethod = "POST", OnSuccess = "OnSuccess", OnBegin = "OnBegin" }))
{
}
寫兩個function OnBegin OnSuccess
var btn = $('#MultipleCreate');
function OnBegin() {
if (!confirm('確定批次新增嗎??')) return false;
btn.button('loading');
}
function OnSuccess(response) {
btn.button('reset');
alert('完成');
}
select
IDENT_SEED('table_name') as 起始值,
IDENT_INCR('table_name') as 每次增值,
IDENT_CURRENT('table_name') as 目前最大值
重置indentity
dbcc checkident('table_name', RESEED, 100)
Insert後取得indentity
Select @@Identity參考來源