What is the best way to showcase several images using Sweet Alert 2?

In the process of developing my Angular 2 application, I have incorporated sweet alert 2 into certain sections. I am looking to showcase multiple images (a minimum of two) at the same time in the pop-up. Does anyone have any suggestions on how to achieve this?

Answer №1

Simply insert the <img> tags within the html parameter like this:

swal({
    title: '<u>example</u>',
    type: 'info',
    html:
    '<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/SNice.svg/1200px-SNice.svg.png" alt="Smiley face" height="42" width="42">'+
    '<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/SNice.svg/1200px-SNice.svg.png" alt="Smiley face" height="42" width="42">',
    showCloseButton: true,
    showCancelButton: true,
    focusConfirm: false,
    confirmButtonText:
    '<i class="fa fa-thumbs-up"></i> Great!',
    confirmButtonAriaLabel: 'Thumbs up, great!',
    cancelButtonText:
    '<i class="fa fa-thumbs-down"></i>',
    cancelButtonAriaLabel: 'Thumbs down',
});

This method enables you to include multiple images in your content (just continue adding image tags). Best of luck with your project!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Vue's v-on:click feature stops functioning correctly post-build

I have successfully integrated the Vue slide example from this link into my Angular template. Everything works fine when running ng serve, but after building with ng build and then trying to start it again with ng serve or from the dist folder using npm s ...

Angularfire2: Navigating to a New Page After User

Currently, I am using ionic 2 rc0 in conjunction with angular 2. I recently incorporated angularfire2 to utilize firebase authentication After configuring and testing everything successfully (my user is visible on the firebase console), I now aim to autom ...

Template URI parameters are being used in a router call

Utilizing the useRouter hook in my current project. Incorporating templated pages throughout the application. Implementing a useEffect hook that responds to changes in the router and makes an API call. Attempting to forward the entire URL to /api/${path ...

How to automatically select an option in a dropdown based on a condition in Angular 2

Currently, I am constructing a select element within a form using an array of objects. My goal is to have one of the options automatically selected based on a specific attribute of the object (myobject.is_default). The initial template code appears as fol ...

Is there a way to transform an angular 2 app.module into ES6 format?

import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; //specific imports remov ...

RXJS expand keeps on recursing indefinitely

After successfully uploading a file to Firebase, I implemented a recursive function to listen for GCP trigger logs. Everything seems to be working well, but I'm facing an issue where the recursive expand function never exits. Despite checking the val ...

Creating a different type by utilizing an existing type for re-use

Can you help me specify that type B in the code sample below should comprise of elements from interface A? The key "id" is mandatory, while both "key" and "value" are optional. interface A { id: string; key: string; value: string | number; } /** ...

Protractor is having trouble locating an element even though the page has finished loading

It seems like a common issue, but I can't seem to find a solution that works for my specific problem. The problem occurs when my test runs fine until it reloads the page and needs to capture an element from a dropdown. I've tried using IsPresent ...

"Utilize the power of RxJS to merge multiple HTTP requests into

As a beginner in RxJS, I am attempting to merge multiple observables to fetch data from a REST API and display it in an ngx-datatable. Inspired by the server-side paging example on ngx-datatable available here, I have created a PageData object: export cla ...

Tips on mocking an ngrx selector within a component

Within a component, we utilize an ngrx selector to access various segments of the state. public isListLoading$ = this.store.select(fromStore.getLoading); public users$ = this.store.select(fromStore.getUsers); The fromStore.method is formed using the ngrx ...

What is the method for defining a function within a TypeScript namespace?

Suppose there is a namespace specified in the file global.d.ts containing a function like this: declare namespace MY_NAMESPACE { function doSomething(): void } What would be the appropriate way to define and describe this function? ...

The powerful combination of Vuetify, Inertia, and Typescript creates a

Currently, I am working with Vuetify and Inertia while using Typescript. I am faced with the challenge of passing shared data to the items prop of a vuetify AutoComplete component: <v-autocomplete :items="$page.props.countries"></v-auto ...

Exploring the TypeScript Type System: Challenges with Arrays Generated and Constant Assertions

I am currently grappling with a core comprehension issue regarding TypeScript, which is highlighted in the code snippet below. I am seeking clarification on why a generated array does not function as expected and if there is a potential solution to this pr ...

Angular2 Cascading Animations

I have been working on implementing cascaded animations for a list of elements. Although I successfully applied the state triggers, following the guidelines in the documentation, I am encountering an issue where all element states are being applied simult ...

Ways to redirect to a different page following a successful execution of a mutation in React-query

I am facing an issue where a memory leak warning appears when I redirect to another page after a mutation. Despite trying various methods, I have not been able to find a solution. The specific warning message is: Warning: Can't perform a React state ...

Is it possible for npm to assist in determining the appropriate version of Primeng that is compatible with Angular 16 dependencies

While trying to add primeng to my project, I ran into an error message: npm i primeng npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: <a href="/cdn-cgi/l/email-protection" class="__cf_email__ ...

Issue: Unable to find the last element using the function findLast in Jest test

While working on a test using jest in Angular, I encountered the following error: Error: TypeError: columnDefs.findLast is not a function The method I am attempting to test is as follows: onKeyDown(key: any) { const columnDefs = this.params.columnApi ...

Is there a way to verify the presence of data and halt code execution if it is not found?

In my data, there is a table containing a total of 5 links. The first 2 links can vary in availability as they are dynamic, while the last 3 links are static and are always displayed. The dynamic links' data is deeply nested within the state object, s ...

Reduce the size of log messages in cypress

I am looking to shorten the cypress messages to a more concise string, for instance: Cypress log Transform to: -assert expected #buy-price-field to have value 17,169.00. Is there a way to achieve this? I have searched through the documentation but hav ...

Creating a custom Angular 2 component with specified HTML template content

I am currently working with Angular 2 and @ng-bootstrap. In my project, I have a modal dialog set up as follows: <template #editDialog let-c="close" let-d="dismiss"> <div class="modal-header"> <button type="button" class="close" ...