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
hpc-team
strudelv2_spa
Commits
94ba5aff
Commit
94ba5aff
authored
Sep 06, 2019
by
Chris Hines
Browse files
forgot to add setttings service
parent
4e6d7f47
Pipeline
#7809
passed with stages
in 13 minutes and 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/app/settings.service.spec.ts
0 → 100644
View file @
94ba5aff
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
SettingsService
}
from
'
./settings.service
'
;
describe
(
'
SettingsService
'
,
()
=>
{
beforeEach
(()
=>
TestBed
.
configureTestingModule
({}));
it
(
'
should be created
'
,
()
=>
{
const
service
:
SettingsService
=
TestBed
.
get
(
SettingsService
);
expect
(
service
).
toBeTruthy
();
});
});
src/app/settings.service.ts
0 → 100644
View file @
94ba5aff
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
BehaviorSubject
}
from
'
rxjs
'
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
SettingsService
{
public
theme$
:
BehaviorSubject
<
string
>
;
public
menuToggle$
:
BehaviorSubject
<
boolean
>
;
public
useMenu$
:
BehaviorSubject
<
boolean
>
;
constructor
()
{
this
.
menuToggle$
=
new
BehaviorSubject
<
boolean
>
(
true
);
this
.
theme$
=
new
BehaviorSubject
<
string
>
(
'
strudel-theme-light
'
);
this
.
useMenu$
=
new
BehaviorSubject
<
boolean
>
(
true
);
this
.
getTheme
();
}
getTheme
()
{
var
theme
:
string
;
theme
=
localStorage
.
getItem
(
'
strudel-theme
'
);
if
(
theme
==
null
)
{
this
.
theme$
.
next
(
'
strudel-theme-light
'
);
return
}
else
{
this
.
theme$
.
next
(
theme
);
}
}
setTheme
(
v
:
string
)
{
this
.
theme$
.
next
(
v
);
localStorage
.
setItem
(
'
strudel-theme
'
,
v
);
}
}
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