Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
hdastageeri
hft_awado_app
Commits
59cc3ed6
Commit
59cc3ed6
authored
Nov 28, 2019
by
Ratnadeep Rajendra Kharade
Browse files
Added service to show toast message.
parent
6fe5f51f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/app/app.module.ts
View file @
59cc3ed6
...
...
@@ -15,6 +15,7 @@ import { IonicStorageModule } from '@ionic/storage';
import
{
AppComponent
}
from
'
./app.component
'
;
import
{
AppRoutingModule
}
from
'
./app-routing.module
'
;
import
{
RestService
}
from
'
./rest.service
'
;
import
{
ToastService
}
from
'
./services/toast.service
'
;
@
NgModule
({
declarations
:
[
AppComponent
],
...
...
@@ -31,6 +32,7 @@ import { RestService } from './rest.service';
StatusBar
,
SplashScreen
,
RestService
,
ToastService
,
{
provide
:
RouteReuseStrategy
,
useClass
:
IonicRouteStrategy
}
],
bootstrap
:
[
AppComponent
]
...
...
src/app/services/toast.service.spec.ts
0 → 100644
View file @
59cc3ed6
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
ToastService
}
from
'
./toast.service
'
;
describe
(
'
ToastService
'
,
()
=>
{
beforeEach
(()
=>
TestBed
.
configureTestingModule
({}));
it
(
'
should be created
'
,
()
=>
{
const
service
:
ToastService
=
TestBed
.
get
(
ToastService
);
expect
(
service
).
toBeTruthy
();
});
});
src/app/services/toast.service.ts
0 → 100644
View file @
59cc3ed6
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
ToastController
}
from
'
@ionic/angular
'
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
ToastService
{
toast
:
any
;
constructor
(
public
toastController
:
ToastController
)
{
}
showToast
(
message
)
{
this
.
toast
=
this
.
toastController
.
create
({
message
:
message
,
duration
:
2000
}).
then
((
toastData
)
=>
{
toastData
.
present
();
});
}
HideToast
(){
this
.
toast
=
this
.
toastController
.
dismiss
();
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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