Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
web-et-numerique
web-et-numerique-internet
data.grandlyon.com
web-portal
components
custom-apps
web-app
Commits
7490923c
Commit
7490923c
authored
Mar 19, 2020
by
FORESTIER Fabien
Browse files
Modify the page title
parent
b9070552
Pipeline
#4361
passed with stage
in 3 minutes and 56 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/app/app.component.ts
View file @
7490923c
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Router
,
NavigationEnd
,
ActivatedRoute
}
from
'
../../node_modules/@angular/router
'
;
import
{
filter
,
map
}
from
'
rxjs/operators
'
;
import
{
AppRoutes
}
from
'
./routes
'
;
import
{
NavigationHistoryService
}
from
'
./core/services
'
;
import
{
Title
}
from
'
@angular/platform-browser
'
;
import
{
Angulartics2Piwik
}
from
'
angulartics2/piwik
'
;
import
{
filter
,
map
}
from
'
rxjs/operators
'
;
import
{
ActivatedRoute
,
NavigationEnd
,
Router
}
from
'
../../node_modules/@angular/router
'
;
import
{
environment
}
from
'
../environments/environment
'
;
import
{
NavigationHistoryService
}
from
'
./core/services
'
;
import
{
AppRoutes
}
from
'
./routes
'
;
@
Component
({
selector
:
'
app-root
'
,
...
...
@@ -34,7 +35,7 @@ export class AppComponent implements OnInit {
filter
(
event
=>
event
instanceof
NavigationEnd
),
map
(()
=>
this
.
_activatedRoute
.
snapshot
),
map
((
route
)
=>
{
const
lang
=
window
.
navigator
.
language
.
includes
(
'
fr
'
)
?
'
fr
'
:
'
en
'
;
const
lang
=
window
.
location
.
href
.
includes
(
environment
.
angularAppHost
.
en
)
?
'
en
'
:
'
fr
'
;
let
r
=
route
;
const
titles
=
[
AppRoutes
.
root
.
title
[
lang
]];
while
(
r
.
firstChild
)
{
...
...
@@ -46,7 +47,7 @@ export class AppComponent implements OnInit {
return
titles
;
}),
).
subscribe
((
titles
)
=>
{
const
title
=
titles
.
join
(
'
•
'
);
const
title
=
titles
.
join
(
'
-
'
);
this
.
_titleService
.
setTitle
(
title
);
});
}
...
...
src/app/routes.ts
View file @
7490923c
...
...
@@ -3,8 +3,8 @@ export const AppRoutes = {
root
:
{
url
:
''
,
title
:
{
fr
:
'
Données
métropolitaines du Grand
Lyon
'
,
en
:
'
Mé
tropolitan
data of the Grand Lyon
'
,
fr
:
'
Données
de la Métropole de
Lyon
'
,
en
:
'
Lyon Me
tropolitan
Area
\'
s Data
'
,
},
},
signin
:
{
...
...
Write
Preview
Supports
Markdown
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