Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Formation Angular
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aneo Web Talents
Angular
Formation Angular
Commits
a7f74ad2
Commit
a7f74ad2
authored
Aug 01, 2019
by
Emile TAVERNE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout pipe capitalize
parent
4e946eef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
1 deletion
+16
-1
app.module.ts
src/app/app.module.ts
+2
-0
trombinoscope-card.component.html
...ents/trombinoscope-card/trombinoscope-card.component.html
+1
-1
capitalize.pipe.ts
src/app/pipes/capitalize.pipe.ts
+12
-0
index.ts
src/app/pipes/index.ts
+1
-0
No files found.
src/app/app.module.ts
View file @
a7f74ad2
...
@@ -6,6 +6,7 @@ import {AppComponent} from './app.component';
...
@@ -6,6 +6,7 @@ import {AppComponent} from './app.component';
import
*
as
Components
from
'./components'
;
import
*
as
Components
from
'./components'
;
import
*
as
Services
from
'./services'
;
import
*
as
Services
from
'./services'
;
import
*
as
Pipes
from
'./pipes'
;
@
NgModule
({
@
NgModule
({
declarations
:
[
declarations
:
[
...
@@ -14,6 +15,7 @@ import * as Services from './services';
...
@@ -14,6 +15,7 @@ import * as Services from './services';
Components
.
LoaderComponent
,
Components
.
LoaderComponent
,
Components
.
PageTrombinoscopeComponent
,
Components
.
PageTrombinoscopeComponent
,
Components
.
TrombinoscopeCardComponent
,
Components
.
TrombinoscopeCardComponent
,
Pipes
.
CapitalizePipe
,
],
],
imports
:
[
imports
:
[
BrowserModule
,
BrowserModule
,
...
...
src/app/components/trombinoscope-card/trombinoscope-card.component.html
View file @
a7f74ad2
<div
*
ngIf=
"person"
class=
"card"
>
<div
*
ngIf=
"person"
class=
"card"
>
<h2
bp=
"text-center"
>
{{ person.fullName }}
</h2>
<h2
bp=
"text-center"
>
{{ person.fullName
| capitalize
}}
</h2>
<img
[
src
]="
person
.
image
"
>
<img
[
src
]="
person
.
image
"
>
</div>
</div>
src/app/pipes/capitalize.pipe.ts
0 → 100644
View file @
a7f74ad2
import
{
Pipe
,
PipeTransform
}
from
'@angular/core'
;
@
Pipe
({
name
:
'capitalize'
})
export
class
CapitalizePipe
implements
PipeTransform
{
transform
(
value
:
string
):
string
{
return
value
.
split
(
' '
)
.
reduce
((
acc
:
string
,
part
:
string
)
=>
{
return
`
${
acc
?
`
${
acc
}
`
:
''
}${
part
.
charAt
(
0
).
toUpperCase
()}${
part
.
slice
(
1
)}
`
;
},
null
);
}
}
src/app/pipes/index.ts
0 → 100644
View file @
a7f74ad2
export
*
from
'./capitalize.pipe'
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment