can't use strong.match(/regex/) in Angular templates
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 23 Jan 2020 14:53:22 +0000 (09:53 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 23 Jan 2020 14:54:40 +0000 (09:54 -0500)
... so in this case, switch to startsWith() and endsWith().
See https://github.com/angular/angular/issues/6419

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html

index 654e429..9b22f46 100644 (file)
         <eg-file-reader [(ngModel)]="t.value1" [ngModelOptions]="{standalone: true}"></eg-file-reader>
       </ng-container>
       <ng-container *ngIf="t.op !== '__in'">
-       <div *ngIf="t.field.match(/:state$/) && (t.op === '' || t.op === '__not'); else notStateField">
+       <div *ngIf="t.field.endsWith(':state') && (t.op === '' || t.op === '__not'); else notStateField">
          <select class="form-control" [ngModelOptions]="{standalone: true}" [(ngModel)]="t.value1">
             <option i18n value="new">New</option>
-            <option i18n *ngIf="!t.field.match(/^acqpo/)" value="selector-ready">Selector-Ready</option>
-            <option i18n *ngIf="!t.field.match(/^acqpo/)" value="order-ready">Order-Ready</option>
-            <option i18n *ngIf="!t.field.match(/^acqpo/)" value="approved">Approved</option>
-            <option i18n *ngIf="t.field.match(/^acqpo/)" value="pending">Pending</option>
-            <option i18n *ngIf="!t.field.match(/^acqpo/)" value="pending-order">Pending-Order</option>
+            <option i18n *ngIf="!t.field.startsWith('acqpo')" value="selector-ready">Selector-Ready</option>
+            <option i18n *ngIf="!t.field.startsWith('acqpo')" value="order-ready">Order-Ready</option>
+            <option i18n *ngIf="!t.field.startsWith('acqpo')" value="approved">Approved</option>
+            <option i18n *ngIf="t.field.startsWith('acqpo')" value="pending">Pending</option>
+            <option i18n *ngIf="!t.field.startsWith('acqpo')" value="pending-order">Pending-Order</option>
             <option i18n value="on-order">On-Order</option>
             <option i18n value="received">Received</option>
             <option i18n value="cancelled">Cancelled</option>