Skip to content

Commit 387fbb8

Browse files
ocombeIgorMinar
authored andcommittedApr 11, 2019
fix(common): add @Injectable() to common pipes (#29834)
PR Close #29834
1 parent 5b32f55 commit 387fbb8

9 files changed

+22
-9
lines changed
 

‎packages/common/src/pipes/async_pipe.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ChangeDetectorRef, EventEmitter, OnDestroy, Pipe, PipeTransform, WrappedValue, ɵisObservable, ɵisPromise} from '@angular/core';
9+
import {ChangeDetectorRef, EventEmitter, Injectable, OnDestroy, Pipe, PipeTransform, WrappedValue, ɵisObservable, ɵisPromise} from '@angular/core';
1010
import {Observable, SubscriptionLike} from 'rxjs';
1111
import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
1212

@@ -67,6 +67,7 @@ const _observableStrategy = new ObservableStrategy();
6767
*
6868
* @publicApi
6969
*/
70+
@Injectable()
7071
@Pipe({name: 'async', pure: false})
7172
export class AsyncPipe implements OnDestroy, PipeTransform {
7273
private _latestValue: any = null;

‎packages/common/src/pipes/case_conversion_pipes.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Pipe, PipeTransform} from '@angular/core';
9+
import {Injectable, Pipe, PipeTransform} from '@angular/core';
1010
import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
1111

1212
/**
@@ -24,6 +24,7 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
2424
* @ngModule CommonModule
2525
* @publicApi
2626
*/
27+
@Injectable()
2728
@Pipe({name: 'lowercase'})
2829
export class LowerCasePipe implements PipeTransform {
2930
/**
@@ -67,6 +68,7 @@ const unicodeWordMatch =
6768
* @ngModule CommonModule
6869
* @publicApi
6970
*/
71+
@Injectable()
7072
@Pipe({name: 'titlecase'})
7173
export class TitleCasePipe implements PipeTransform {
7274
/**
@@ -91,6 +93,7 @@ export class TitleCasePipe implements PipeTransform {
9193
* @ngModule CommonModule
9294
* @publicApi
9395
*/
96+
@Injectable()
9497
@Pipe({name: 'uppercase'})
9598
export class UpperCasePipe implements PipeTransform {
9699
/**

‎packages/common/src/pipes/date_pipe.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Inject, LOCALE_ID, Pipe, PipeTransform} from '@angular/core';
9+
import {Inject, Injectable, LOCALE_ID, Pipe, PipeTransform} from '@angular/core';
1010
import {formatDate} from '../i18n/format_date';
1111
import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
1212

@@ -150,6 +150,7 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
150150
* @publicApi
151151
*/
152152
// clang-format on
153+
@Injectable()
153154
@Pipe({name: 'date', pure: true})
154155
export class DatePipe implements PipeTransform {
155156
constructor(@Inject(LOCALE_ID) private locale: string) {}

‎packages/common/src/pipes/i18n_plural_pipe.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {LOCALE_ID, Pipe, PipeTransform} from '@angular/core';
9+
import {Injectable, LOCALE_ID, Pipe, PipeTransform} from '@angular/core';
1010
import {NgLocalization, getPluralCategory} from '../i18n/localization';
1111
import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
1212

@@ -26,6 +26,7 @@ const _INTERPOLATION_REGEXP: RegExp = /#/g;
2626
*
2727
* @publicApi
2828
*/
29+
@Injectable()
2930
@Pipe({name: 'i18nPlural', pure: true})
3031
export class I18nPluralPipe implements PipeTransform {
3132
constructor(private _localization: NgLocalization) {}

‎packages/common/src/pipes/i18n_select_pipe.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Pipe, PipeTransform} from '@angular/core';
9+
import {Injectable, Pipe, PipeTransform} from '@angular/core';
1010
import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
1111

1212
/**
@@ -26,6 +26,7 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
2626
*
2727
* @publicApi
2828
*/
29+
@Injectable()
2930
@Pipe({name: 'i18nSelect', pure: true})
3031
export class I18nSelectPipe implements PipeTransform {
3132
/**

‎packages/common/src/pipes/json_pipe.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Pipe, PipeTransform} from '@angular/core';
9+
import {Injectable, Pipe, PipeTransform} from '@angular/core';
1010

1111
/**
1212
* @ngModule CommonModule
@@ -23,6 +23,7 @@ import {Pipe, PipeTransform} from '@angular/core';
2323
*
2424
* @publicApi
2525
*/
26+
@Injectable()
2627
@Pipe({name: 'json', pure: false})
2728
export class JsonPipe implements PipeTransform {
2829
/**

‎packages/common/src/pipes/keyvalue_pipe.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {KeyValueChangeRecord, KeyValueChanges, KeyValueDiffer, KeyValueDiffers, Pipe, PipeTransform} from '@angular/core';
9+
import {Injectable, KeyValueChangeRecord, KeyValueChanges, KeyValueDiffer, KeyValueDiffers, Pipe, PipeTransform} from '@angular/core';
1010

1111
function makeKeyValuePair<K, V>(key: K, value: V): KeyValue<K, V> {
1212
return {key: key, value: value};
@@ -43,6 +43,7 @@ export interface KeyValue<K, V> {
4343
*
4444
* @publicApi
4545
*/
46+
@Injectable()
4647
@Pipe({name: 'keyvalue', pure: false})
4748
export class KeyValuePipe implements PipeTransform {
4849
constructor(private readonly differs: KeyValueDiffers) {}

‎packages/common/src/pipes/number_pipe.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Inject, LOCALE_ID, Pipe, PipeTransform} from '@angular/core';
9+
import {Inject, Injectable, LOCALE_ID, Pipe, PipeTransform} from '@angular/core';
1010
import {formatCurrency, formatNumber, formatPercent} from '../i18n/format_number';
1111
import {getCurrencySymbol} from '../i18n/locale_data_api';
1212
import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
@@ -46,6 +46,7 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
4646
*
4747
* @publicApi
4848
*/
49+
@Injectable()
4950
@Pipe({name: 'number'})
5051
export class DecimalPipe implements PipeTransform {
5152
constructor(@Inject(LOCALE_ID) private _locale: string) {}
@@ -99,6 +100,7 @@ export class DecimalPipe implements PipeTransform {
99100
*
100101
* @publicApi
101102
*/
103+
@Injectable()
102104
@Pipe({name: 'percent'})
103105
export class PercentPipe implements PipeTransform {
104106
constructor(@Inject(LOCALE_ID) private _locale: string) {}
@@ -153,6 +155,7 @@ export class PercentPipe implements PipeTransform {
153155
*
154156
* @publicApi
155157
*/
158+
@Injectable()
156159
@Pipe({name: 'currency'})
157160
export class CurrencyPipe implements PipeTransform {
158161
constructor(@Inject(LOCALE_ID) private _locale: string) {}

‎packages/common/src/pipes/slice_pipe.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Pipe, PipeTransform} from '@angular/core';
9+
import {Injectable, Pipe, PipeTransform} from '@angular/core';
1010
import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
1111

1212
/**
@@ -44,6 +44,7 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
4444
*
4545
* @publicApi
4646
*/
47+
@Injectable()
4748
@Pipe({name: 'slice', pure: false})
4849
export class SlicePipe implements PipeTransform {
4950
/**

0 commit comments

Comments
 (0)
Please sign in to comment.