You can check the module import here
.
leftpad
Returns a left-padded string.
File
Copy import { NgLeftPadPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'aaa' | leftpad: 4 }}
<!-- ' aaa' -->
{{ 'aaa' | leftpad: 3 }}
<!-- 'aaa' -->
{{ 'aaa' | leftpad: 5: 'b' }}
<!-- 'bbaaa' -->
rightpad
Returns a right-padded string.
File
Copy import { NgRightPadPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'aaa' | rightpad: 4 }}
<!-- 'aaa ' -->
{{ 'aaa' | rightpad: 3 }}
<!-- 'aaa' -->
{{ 'aaa' | rightpad: 5: 'b' }}
<!-- 'aaabb' -->
pad
Returns a padded string. It starts with left and then right.
File
Copy import { NgPadPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'aaa' | pad: 4 }}
<!-- ' aaa' -->
{{ 'aaa' | pad: 5 }}
<!-- ' aaa ' -->
{{ 'aaa' | pad: 5: 'b' }}
<!-- 'baaab' -->
trim
Trims the string.
File
Copy import { NgTrimPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'aaa' | trim }}
<!-- 'aaa' -->
{{ 'aaa ' | trim }}
<!-- 'aaa' -->
{{ ' aaa ' | trim }}
<!-- 'aaa' -->
split
Split a string into an array.
File
Copy import { NgSplitPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'Hello World' | split }}
<!-- ['Hello', 'World'] -->
{{ 'ABABA' | split: 'B' }}
<!-- ['A', 'A', 'A'] -->
{{ 'ABABA' | split: 'B': 2 }}
<!-- ['A', 'A'] -->
replace
This is the String#replace()
function, if you want to know more about the arguments, check the official documentation.
File
Copy import { NgReplacePipeModule } from 'angular-pipes' ;
match
This is the String#match()
function, if you want to know more about the arguments, check the official documentation.
File
Copy import { NgMatchPipeModule } from 'angular-pipes' ;
test
This is the String#test()
function, if you want to know more about the arguments, check the official documentation.
File
Copy import { NgTestPipeModule } from 'angular-pipes' ;
newlines
Replaces the \n
, \r
and \r\n
into <br />
. This function returns HTML so you need to use it
with the [innerHTML]
binding.
File
Copy import { NgNewlinesPipeModule } from 'angular-pipes' ;
Usage
Copy this .value = 'Hello, World. \nHow are you ?' ;
Copy <span [innerHTML]="value | newlines"></span>
<!-- Resulting dom
<span>
Hello, World. <br /> How are you ?
</span>
-->
<!-- Resulting display
Hello, World.
How are you ?
-->
capitalize
Capitalize the string. If the argument is true, all the words will be capitalized.
File
Copy import { NgCapitalizePipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'hello world' | capitalize }}
<!-- 'Hello world' -->
{{ 'hello world' | capitalize: true }}
<!-- 'Hello World' -->
{{ 'hELLo wOrld' | capitalize: true }}
<!-- 'Hello World' -->
upperfirst
Uppercase the first letter.
File
Copy import { NgUpperFirstPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'hello world' | upperfirst }}
<!-- 'Hello world' -->
template
Template string.
File
Copy import { NgTemplatePipeModule } from 'angular-pipes' ;
Usage
Copy {{ "Hello $1, it's $2" | template: 'world': 'me' }}
<!-- 'Hello world, it's me' -->
encodeuri
The encodeURI function.
File
Copy import { NgEncodeURIPipeModule } from 'angular-pipes' ;
encodeuricomponent
The encodeURIComponent function.
File
Copy import { NgEncodeURIComponentPipeModule } from 'angular-pipes' ;
decodeuri
The decodeURI function.
File
Copy import { NgDecodeURIPipeModule } from 'angular-pipes' ;
decodeuricomponent
The decodeURIComponent function.
File
Copy import { NgDecodeURIComponentPipeModule } from 'angular-pipes' ;
repeat
Repeats a string.
File
Copy import { NgRepeatPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'a' | repeat: 2 }}
<!-- 'aa' -->
{{ 'a' | repeat: 2: 'b' }}
<!-- 'aba' -->
truncate
Truncate a string.
Arguments: (size, suffix, preserve)
File
Copy import { NgTruncatePipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'Hello World' | truncate: 4 }}
<!-- 'Hell' -->
{{ 'Hello World' | truncate: 4: '': true }}
<!-- 'Hello' -->
{{ 'Hello World' | truncate: 4: '...': true }}
<!-- 'Hello...' -->
{{ 'Hello World, how is it going?' | truncate: 14: '...': true }}
<!-- 'Hello World, how...' -->
slugify
Slugify a string.
Arguments: (string)
File
Copy import { NgSlugifyPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'The zombie world war began' | slugify }}
<!-- 'the-zombie-world-war-began' -->
striptags
strip out html tags from string
Important: this Pipe jobs it's not to replace innerHtml directive, it's only for tiny plain text
Arguments: ( string, ends, case-sensitive[optional] )
File
Copy import { NgStripTagsPipeModule } from 'angular-pipes' ;
Usage
Copy var text = '
<p class="paragraph">Lorem Ipsum is simply dummy text of the printing...</p>
';
<p>{{ text | stripTags }}</p>
<!--result: Lorem Ipsum is simply dummy text of the printing... -->
latinize
Remove accents/diacritics from a string
File
Copy import { NgLatinizePipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'Sòme strÏng with Âccénts' | latinize }}
<!-- result: Some strIng with Accents -->
wrap
Wrap a string with another string
Arguments: ( string, string, string[optional] )
File
Copy import { NgWrapPipeModule } from 'angular-pipes' ;
Usage
Copy <p>{{ 'foo' | wrap: '/' }}</p>
<!--result: /foo/ -->
<p>{{ 'foo' | wrap: '{{': '}}' }}</p>
<!--result: {{foo}} -->
with
With pipe check string has start and/or ends
Arguments: ( string, start[optional], ends[optional], case-sensitive[optional] )
File
Copy import { NgWithPipeModule } from 'angular-pipes' ;
Usage
Copy {{'The Flash Reverse' | with: 'The' : null, true}}
<!-- result: true -->
{{'The Flash Reverse' | with: 'The' : 'Reverse' : true}}
<!-- result: true-->
{{'The Flash Reverse' | with: 'The' : 'Reverse'}}
<!-- result: true-->
{{'The Flash Reverse' | with: 'the' : 'reverse'}}
<!-- result: true-->
{{'The Flash Reverse' | with: 'the' : 'Reverse' : true}}
<!-- result: false-->
{{'The Flash Reverse' | with: 'the' : 'reverse' : true}}
<!-- result: false-->
{{'The Flash Reverse' | with: 'Blue' : 'Reverse' : true}}
<!-- result: false-->
{{'The Flash Reverse' | with: 'The' : 'Black' : true}}
<!-- result: false-->
{{'The Flash Reverse' | with: '' : 'Black' : true}}
<!-- result: false-->
{{'The Flash Reverse' | with: '' : '' : true}}
<!-- result: 'The Flash Reverse'-->
{{'The Flash Reverse' | with: null : null : true}}
<!-- result: 'The Flash Reverse'-->
{{'The Flash Reverse' | with: null : null}}
<!-- result: 'The Flash Reverse'-->
{{'The Flash Reverse' | with}}
<!-- result: 'The Flash Reverse'-->
reversestr
Reverse a string.
File
Copy import { NgReverseStrPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 'hello world' | reverseStr }}
<!-- 'dlrow olleh' -->