Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

how to make splash screen as loading/progress screen


hi there,
is there any way to make splash screen as loadin/progress screen while getting response from api?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Yes, you can create a splash screen that serves as a loading or progress screen while waiting for a response from an API in an Angular application. Here's a general outline of how to achieve this:

Create a Splash Component: First, create a new Angular component for your splash screen. You can use the Angular CLI to generate a new component:


ng generate component splash


Design Your Splash Screen: In the newly created splash component, design your splash screen as you like. This might include a logo, loading spinner, or any other elements you want to display.

Show Splash Screen: In your Angular application, you can display the splash screen by default when your application starts. You can do this in your main app.component.html:


< app-splash *ngIf="showSplash"></app-splash>
< app-root *ngIf="!showSplash"></app-root>


In this code, showSplash is a variable in your component that controls whether the splash screen should be shown or not. Initially, you can set it to true to show the splash screen.

Fetching Data from API: When you make an API request, you can set showSplash to true before the request and set it to false when the response is received.


// Inside your component when start calling API
showSplash = true;

ngOnInit() {
// Simulate an API request
this.userService.getDataFromAPI().subscribe(
(response) => {
// Process the response data
// ...

// Hide the splash screen
this.showSplash = false;
},
(error) => {
// Handle errors
// ...

// Hide the splash screen
this.showSplash = false;
}
);
}


Replace this.userService.getDataFromAPI() with your actual API request.



Great Thanks! ... let me try this and get back to you if any issue.



Certainly, take your time to test it out. If you encounter any issues or have any questions, feel free to reach out. We're here to help!



hi there,

im using ngx spinner. works perfectly.
Thanks for your feedback!



You're welcome! I'm glad to hear. If you have any more questions or need further assistance, feel free to ask.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(