Angular 8Angular 9Sweetalert

Angular 8 Sweetalert working example

Angular 8 Sweetalert working example
Views

Hello to all, welcome again on therichpost.com. In this post, I will tell you, Angular 8 Sweetalert working example.

Post Working:

In this post, I am showing sweetalert in Angular 8.
Nodejs - Fullcalendar Working Example
Angular 8 Sweetalert working example

Here is the working code snippet and please follow carefully:

1. Very first, here are common basics steps to add angular 8 application on your machine:

$ npm install -g @angular/cli

$ ng new angularsweetalert // Set Angular8 Application on your pc

cd angularsweetalert // Go inside project folder

ng serve // Run project

http://localhost:4200/  //Check working Local server

 

2. Now run below command into your terminal to include sweetalert package into your angular 8 application:

npm install --save sweetalert2

 

3. Now add below code into your angular.json file:

"styles": [
         ...
          "node_modules/sweetalert2/src/sweetalert2.scss"
          ]

 

 

5. Finally add, below code into your app.component.ts file:

import Swal from 'sweetalert2/dist/sweetalert2.js';


....
ngOnInit() {
      Swal.fire({
        text: 'Hello!',
        icon: 'success'
      });
}
....

 

This is it and if you have any kind of query then please let me know.

Jas

Thank you

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Positive SSL