Files
Shuaib Hasan Akib 7345bdc06b refactor(common): update pipe examples and remove redundant standalone flag (#64135)
Updated pipe examples to explicitly import the pipe for clarity and
correctness. Also removed `standalone: true` since it is now the default
and no longer necessary.

PR Close #64135
2025-09-30 15:31:11 -04:00

37 lines
888 B
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {registerLocaleData, PercentPipe} from '@angular/common';
import {Component} from '@angular/core';
// we need to import data for the french locale
import localeFr from './locale-fr';
// registering french data
registerLocaleData(localeFr);
// #docregion PercentPipe
@Component({
selector: 'percent-pipe',
imports: [PercentPipe],
template: `<div>
<!--output '26%'-->
<p>A: {{ a | percent }}</p>
<!--output '0,134.950%'-->
<p>B: {{ b | percent: '4.3-5' }}</p>
<!--output '0 134,950 %'-->
<p>B: {{ b | percent: '4.3-5' : 'fr' }}</p>
</div>`,
})
export class PercentPipeComponent {
a: number = 0.259;
b: number = 1.3495;
}
// #enddocregion