發表文章

[Angular] 使用routerlink來根據組成網址加上/?aaaa=ooooo的參數傳遞

測試:http://10.172.207.72/webdoc/FINANCE/PayForm/PayFormView.asp?aplno=1207000006 正式: http://intranet.pscnet.com.tw/webdoc/FINANCE/PayForm/PayFormView.asp?aplno=1207000719 payApplicationNoURL = environment . PaymentApplicationNoURL ;     < a                 [ routerLink ] = " [ payApplicationNoURL ] "                 [ queryParams ] = " { aplno : element . formId } "                 matTooltip = " {{ payApplicationNoURL }} "                 >{{ element . formId }}</ a               > 但是實際上這樣只能在網頁有的頁面使用而已 因為路徑會發現網站沒這路徑 就跳回登入頁面

[Angular] 使用cli指令,一次增加module和module-route

   ng generate module demandDepartment --route demandDepartment --module app.module

[Angular Material] Star Rating 星星評分做法(有兩種)

  Angular Material Star Rating - StackBlitz Angular 6 Stars Rating Component - Plunker (plnkr.co)

[Angular] 使用Pipe來解決innerHTML造成的 sanitizing HTML stripped some content 錯誤

  使用Angular嵌入HTML 會造成錯誤 因為ANGULAR架構會避免XSS攻擊 會對內容做編譯 這樣我們要呈現的內容就會被削掉 所以要使用自定義的pipe來消毒 讓內容可以轉換並呈現 https://stackoverflow.com/questions/39681163/angular-2-sanitizing-html-stripped-some-content-with-div-id-this-is-bug-or-fe https://stackoverflow.com/questions/47681813/angular-sanitizing-html-stripped-some-content-on-css-style html <mat-card [innerHTML]="activeMeterApiFormat | sanitizeHtml"></mat-card> ts //#region 串cr004GetHtml API     this.cr004Service.cr004GetHtml$Json$Response(params).subscribe({       next: (res: any) => {         this.activeMeterApiFormat = Object.values(res.body.body!).toString();       },     });     //#endregion Pipe import { Pipe, PipeTransform } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; @Pipe({   name: 'sanitizeHtml' }) export class SanitizeHtmlPipe implements PipeTransform {   constructor(private _san...

[Angular Material] 在table抓取最後一行做樣式

  angular material table中 因為*matRowDef是語法糖 裡面包含了*ngFor 所以可以運用 https://angular.io/api/common/NgForOf#local-variables 中的導出值 所以加上   let last = last 以及加上   [ ngClass ] = " { ' last-child ' : last } " 讓指定的最後一個元素有class 有了class後就能用css去指定並設定樣式 HTML   < tr               mat-row               * matRowDef = "                 let row ;                 columns : innerDisplayedColumns ;                 let last = last               "               [ ngClass ] = " { ' last-child ' : last } "             ></ tr > CSS . last-child {   font-weight : bold ; }

[Git] 檔案路徑過長導致git無法儲存解法

  让 git 支持长文件名_徐晓伟的博客-CSDN博客 https://blog.csdn.net/qq_32596527/article/details/105799844 cmd 运行(需要将 git 添加到环境变量中): git config --global core.longpaths true 如果是Windows 10,还需要通过注册表或组策略,解除操作系统的文件名长度限制(需要重启,以下方式二选一): 在注册表编辑器中创建HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled, 类型为REG_DWORD,并设置为1。 或者从系统菜单点击设置图标,输入“编辑组策略”, 然后在打开的窗口依次进入“计算机管理” > “管理模板” > “系统” > “文件系统”,在右侧双击“启用 win32 长路径”。 ———————————————— 版权声明:本文为CSDN博主「徐晓伟」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_32596527/article/details/105799844

[Angular] 使用ngForTrackBy 來提升*ngFor的效能

  詳細文章 https://dotblogs.com.tw/explooosion/2017/04/29/035512 用法 < li * ngFor = "let item of items ; trackBy:trackByFn ; let i=index" > {{i}} - {{ item.name }} </ li > trackByFn(index, item) { return index; // or item.name }