Show a notification to the user through a pop-up message when they either select or deselect the checkbox in an Angular application

Suppose the user first selects the value for "Automatic" and then changes it to an unchecked state. An alert message will appear if any of the following accordions are in the "Completed" status.

Answer №1

HTML
<div class="col-md-12 col-sm-12 filter-opn">
   <form #checkboxfilt="ngForm" (ngSubmit)="onapplyfilter(checkboxfilt)">
    <div> 
       <div>
          <input  type="checkbox"   name="Success" value="1" ngModel selected  ><br>
          <label for="Success"> Success</label><br>
       </div>
        <div>
          <input type="checkbox"   name="Pending" value="2" ngModel ><br>
           <label for="Pending"> Pending</label><br>
        </div>
        <div>
          <input type="checkbox"   name="Canceled" value="3" ngModel ><br>
          <label for="Canceled"> Canceled</label><br>
       </div>
                           
       <input type="submit" value="Apply">
        <br>
    </div>
  </form>
</div>

TS

onapplyfilter(checkbox:NgForm){

if((checkbox.value.Success ==''|| checkbox.value.Success==false) 
        &&(checkbox.value.Pending ==''|| checkbox.value.Pending==false)
        &&(checkbox.value.Canceled ==''|| checkbox.value.Canceled==false))
        {
            alert('Checkbox cannot be empty');
        }
  }


}

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

Element within grid not stretching to full width

My experience with using grid is still quite fresh. Although I've completed a few projects, I'm struggling with some issues. One of them involves setting the grid element to 100%, but it seems to be getting clipped at 80%. It appears like such a ...

The response from my reducer was a resounding "never," causing selectors to be unable to accurately detect the state

Currently utilizing the most recent version of react. I am attempting to retrieve the state of the current screen shot, but encountering an error indicating that the type is an empty object and the reducer is "never". I am unable to detect the state at all ...

Creating a table using data from an Angular form

As I attempt to create a table that takes user-entered form data, stores it on the client-side, and organizes each input property into a group to form an object, I encounter an issue. Despite starting the code below, nothing seems to be working. Can anyone ...

The issue of a blank first page occurring when attempting to print the contents of an

I am encountering an issue with printing a webpage that contains three images. When printing directly from Internet Explorer, it correctly prints three pages, one for each image. However, when loading the same page within an iframe and printing the iframe ...

Troubleshooting guide: Issues with compatibility between Angular 5 and Bootstrap 4

Upon creating a fresh Angular 5 project, I decided to integrate Bootstrap 4.0.0 using the guidelines provided on the Angular CLI GitHub page. Following the instructions, I utilized 'npm install bootstrap' to incorporate Bootstrap into my project. ...

tag containing inner text of span tag tagged with anchor tag

Using JavaScript, I have dynamically assigned an anchor tag within a span tag. However, the href attribute of the anchor tag is being formed incorrectly. Here is the JavaScript code: var HF1Id , HF2Id , SpanId , HF1Id = '<%=Request("HF1Id") %> ...

Creating a draggable element that can be reverted once it is added to a list and has a dynamically generated inline style tag

There are numerous questions related to this topic on stackoverflow, such as How to make dynamically added list elements draggable in jQuery? However, I am attempting something unique. I am adding my list elements during the page load as shown below: < ...

Warning: Unhandled Promise Rejection - Alert: Unhandled Promise Rejection Detected - Attention: Deprecation Notice

Encountering the following error message: (node:18420) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined at C:\Users\ohrid\Desktop\backend2\routes\categories.js:27:24 at Layer.han ...

What steps can I take to have TypeScript limit the type of an array based on filter inference?

Here's a handy function that always returns an array of strings: (arr: (string | undefined)[]): string[] => arr.filter(item => item !== undefined); Check it out here However, TypeScript may not compile this code as expected due to its inferenc ...

"Angular File Upload Made Easy with Drag-and-Drop Functionality and Cleverly Positioned

Encountering an issue with Angular File upload in conjunction with relatively positioned elements. The drop target is set to 100% width and height, absolutely positioned. While dragging a file over any non-relatively positioned element, the overlay functio ...

Conceal table headers on mobile devices for better responsiveness styling

I have implemented jQuery Datatables to display a table and made it mobile responsive. However, I am facing an issue where I want to completely hide the table headers when viewing the table on a mobile device, and show them again on a normal screen. Speci ...

JSON object fails to iterate with ng-repeat

It must be the scorching temperature... Having a json object that I'm eager to loop through using ng-repeat, it should be straightforward, but alas! it's just not cooperating. Here's the HTML snippet: <a data-ng-repeat="x in template.m ...

Apply a vibrant red color to the border input (twig)

Hi everyone, I'm facing a little issue where my input is not changing to red color. I have tried to troubleshoot my code but can't seem to find the problem. Can anyone help? Here is my HTML code (Twig): {{ form_widget(form.value, {&apos ...

What are the methods to ascertain whether an HTML element possesses a pseudo element?

Is there a method to identify whether an HTML element has a pseudo element (::before / ::after) applied to it without invoking the function: window.getComputedStyle(element, ":before/:after"); MODIFIED: the response is NEGATIVE The issue with getCompute ...

The Angular checkbox is not checking in the view despite having a true value in the scope

After clicking "Cancel" in the modal window, the checkbox is unchecked even though it should remain checked (the scope.enabledLogin value is true after pressing the "Cancel" button and dismissing the modal window). Why is this happening? Jade: .checkbox( ...

Iterate over an ASP.Net table using a loop

Currently, I am facing a challenge with looping through a table that is dynamically created using C#. I have a client-side checkbox that should trigger the loop each time it's clicked. While I believe I can manage the looping process itself, I am enco ...

There seems to be a problem as exits.success is not a recognized function -

Currently, I am exploring how to utilize Sails.js with the node-machine-syntax specifically in the context of listing flights. The code snippet below outlines my attempt at achieving this: /** * FlightsController * * @description :: Server-side actions fo ...

Unveiling the Secrets: Scraping HTML Code from a Webpage Dynamically Using Selenium and Python

Learning Selenium has been quite challenging for me as I am just getting started. I have a total of 3 buttons on a webpage, and after each button click, my goal is to retrieve the entire HTML code of the page (I am comfortable using BeautifulSoup for any n ...

Prevent text wrapping and clear floats in a clean and hack-free way

I am currently in the process of compiling a collection of blurbs accompanied by images that can be easily integrated into any section of our website. My goal is to ensure that these blurbs are versatile, free from rigid width specifications, and compatibl ...

Adding up the values of an array of objects by month using ReactJS

To start off, I'm using ChartJS and need to create an array of months. Here's how it looks: const [generatedMonths, setGeneratedMonths] = useState<string[]>([]) const [totalValues, setTotalValues] = useState<number[]>([]) const month ...