Bummer. This is still the case with Angular 5.
I've created a custom pipe which applies a lowercase transform to the text matching a provided regex.
Lowercase Match Pipe
lowercase-match.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'lowercaseMatch'
})
export class LowerCaseMatchPipe implements PipeTransform {
transform (input: any, pattern: any): any {
if (!this.isString(input)) {
return input;
}
const regexp = pattern instanceof RegExp ? pattern : new RegExp(pattern, 'gi');
return input.toLowerCase()
if (input.match(regexp)) {
return input.toLowerCase()
}
return input
}
isString(value: any): boolean {
return typeof value === 'string';
}
}
Usage
Import to Module
import { LowerCaseMatchPipe } from './lowercase-match.pipe';
@NgModule({
declarations: [
...
LowerCaseMatchPipe
],
...
})
export class AppModule { }
Display date with lowercase am/pm
{{ today | date : 'EEEE, MMMM d, h:mm a' | lowercaseMatch : 'am|pm' }}
There is some discussion about this casing notion on an GitHub Issue for Angular
https://github.com/angular/angular.js/issues/8763