aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Angularjs Show (Display) Confirm Dialog Box Example on ng-click Button Event

Jun 22, 2015

Here I will explain how to show confirm dialog box message in
AngularJS example using ng-click directive or show / display JavaScript dialog confirm message box with example in AngularJS using ng-click with example. Generally in JavaScript we will use “window” property to show confirm dialog box same way in AngularJS we will use “$window” property show confirm dialog message box.

In previous articles I explained Angularjs show hide div on checkbox selection,
Angularjs refresh div for every 1 second using interval mode, Angularjs convert number to currency format, Angularjs get dropdownlist selected value, Angularjs convert text to uppercase while typing and many articles relating to AngularJS, jQuery, JavaScript and Now I will explain how to show confirm dialog box message in AngularJS with example using ng-click directive.

To show confirm box in AngularJS we need to write the code like as shown below

$scope.showconfirmbox = function () {
if ($window.confirm("Do you want to continue?"))
$scope.result = "Yes";
$scope.result = "No";

If you want to check it in complete example you need to write the code like as shown below

<html xmlns="">
<title>Angularjs Show JavaScript Confrim Message</title>
<script src=""></script>
<script type="text/javascript">
var myapp = angular.module('sampleapp', []);
myapp.controller("sampleController", function ($scope, $window) {
$scope.showconfirmbox = function () {
if ($window.confirm("Do you want to continue?"))
$scope.result = "Yes";
$scope.result = "No";
<form id="form1">
<div data-ng-app="sampleapp" data-ng-controller="sampleController">
<input type="button" value="Show Confirm Box" ng-click="showconfirmbox()" />
<span>Your Answer:<b>{{result}}</b></span>

Live Demo

For live demo click below button to show confirm box

Your Answer:{{result}}

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Karmesh Madhavi said...

Thank you Suresh bhai, it's help me out...

Give your Valuable Comments

Other Related Posts

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.