Introduction:
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.
Description:
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 asp.net. Now I will explain how to show confirm dialog box message in AngularJS with example using ng-click directive.
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 asp.net. Now I will explain how to show confirm dialog box message in AngularJS with example using ng-click directive.
|
If you want to check it in complete example you need to
write the code like as shown below
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Angularjs Show
JavaScript Confrim Message</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></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";
else
$scope.result = "No";
}
})
</script>
</head>
<body>
<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>
</div>
</form>
</body>
</html>
|
Live
Demo
For
live demo click below button to show confirm box
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
3 comments :
Thank you Suresh bhai, it's help me out...
How can i open modal popup confirm box in angular
Thank you so much. You saved my time.
Note: Only a member of this blog may post a comment.