發表文章

目前顯示的是 3月, 2020的文章

[Angular] 身分證驗證器(directive Validator)

身分證的產生和驗證是很常見的表單需求 idno-valiator.directive.ts import   {   AbstractControl ,   ValidatorFn   }   from   ' @angular/forms ' ; export   function   IdnoValiator () :   ValidatorFn   {    return   ( control :   AbstractControl ) :   {  [ key :   string ] :   any   }   |   null   =>   {      if  ( ! control . value )  {        return   null ;      }      const   valid   =   checkID ( control . value ) ;      return   valid   ?   null   :   {   idnoCheck :   true   };    }; } function   checkID ( id )   {    //  建立字母分數陣列(A~Z)    const   city   =   new   Array (      1 ,  ...

[.NET] .NET Core和.NET framwork升版本分析 (使用.NET Portability Analyzer)

圖片
前情提要 公司版本 .NET Core 2.2.1 .NET framwork 4.6.2 目標 .NET Core要升3.1.2 .NET framwork 要升4.8 解決方向 在看完相關文章後 選擇自動化的分析工具 .NET Portability Analyzer  (也稱ApiPort) 來分析並產生報表 跑完後會產生excel 總表如下 還可以分頁看細項 所以比對項目和改寫未支援的項目後 就可以確認升級會不會有問題了 參考 https://blog.darkthread.net/blog/netcore-3-release/ 官方 https://docs.microsoft.com/en-us/dotnet/standard/analyzers/portability-analyzer 如何看自己電腦framwork版本 https://docs.microsoft.com/zh-tw/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed 從 ASP.NET Core 2.2 遷移至 3.0 https://docs.microsoft.com/zh-tw/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio 筆記:ASP.NET Core 2.2 升級 3.1 經驗一則 https://blog.darkthread.net/blog/upgrade-netcore-22-to-31/

[Angular Material] 如何解決在mat-tab內部出現的小上下捲動條scrollbar。使用dynamicHeight

圖片
有時會出現這個狀況 外部scrollbar以外,內部的tab也會出現scrollbar 造成操作的卡頓和不直覺 解決方法: 在 < mat-tab-group   mat-stretch-tabs   > 中加上 dynamicHeight   變成 < mat-tab-group   mat-stretch-tabs   dynamicHeight > 這樣就能解決了 引用stockoverflow https://stackoverflow.com/questions/53778677/how-to-remove-scrollbar-from-mat-tab-or-mat-card-angular-material Problem Solved:  Just add  dynamicHeight  to  <mat-tab-group>

[Angular] Custom validators驗證器設置方式

圖片
設置綁定 可以在formbuilder 上或是 formgroup上綁 如在service中 createForm ()   {      this . serviceFormGroup   =   this . fb . group ( {           Empno :  [ '' ] ,        CustomerAccount :  [          '' ,         [            Validators . required ,            Validators . pattern ( ' ^[0-9]*$ ' ) ,            Validators . minLength ( 7 ) ,            Validators . maxLength ( 7 ) ,         ] ,       ] ,            FinancingStockAmount :  [ '' ] ,  ...

[Anular Material] 輸入自動轉成大寫

在HTML的input 標籤內加上 oninput="this.value = this.value.toUpperCase()" 引用 https://stackoverflow.com/questions/50446592/typescript-html-how-to-force-uppercase-in-an-input-field/50447152 You can simply add  oninput="this.value = this.value.toUpperCase()"  in your  <input>  tag and it will instantly convert any input in your input field to Uppercase.