Files
angular__angular/packages/examples/common/pipes/ts/percent_pipe.ts
Joey Perrott c4b880a025 refactor: migrate docs, examples, private, service worker and upgrade to prettier formatting (#54163)
Migrate formatting to prettier for docs, examples, private, service worker and upgrade from clang-format

PR Close #54163
2024-01-30 20:08:40 +00:00

36 lines
848 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.io/license
*/
import {registerLocaleData} 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',
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