Animation
The Dialog component can be animated while opening and closing the dialog.
We can specify the effect and the duration for the animation. The two types of effects of Dialog are slide and fade. We can configure these settings separately for open and close dialog actions.
<div id="dialog" ej-dialog e-title="Dialog" e-actionbuttons="Icons" e-animation-show="Effect" e-animation-show="Duration" e-animation-hide="Effects" e-animation-hide="Duration">
<p>This is a simple dialog</p>
</div>
<script>
angular.module('dialogApp', ['ejangular'])
.controller('DialogCtrl', function ($scope) {
$scope.Icons = ["close", "maximize", "minimize"]
$scope.Effect="slide",
$scope.Duration=500,
$scope.Effects="fade"
$scope.Duration= 500
});
</script>
Loading Dialog content
By default, the content inside the Dialog element is simply the user given content. But also, we can render the Dialog’s component content through the following ways.
-
AJAX
-
Using iframe
-
iImage
This settings can be specified through e-contenttype property.
AJAX
We can load the content through AJAX by setting the e-contenttype property as ajax
<div id="dialog" ej-dialog e-title="Dialog" e-contenturl="dialogContent.html" e-contenttype="ajax"/>;
The content of that dialogContent.html file is below:
<div id=”content”> This content is loaded via AJAX request. </div>
We can handle the AJAX request’s success and failures through the events “e-ajaxsuccess” and “e-ajaxerror” events respectively. See also ajaxSuccess and ajaxError
The previous example is modified as below to handle the success and failure events.
<div id="dialog" ej-dialog e-title="Dialog" e-contenturl="dialogContent.html" e-contenttype="ajax" e-ajaxsuccess="onSuccess" e-ajaxerror="onError"/>;
Iframe
We can also load the content in iframe by setting the e-contenttype property as iframe.
<div id="dialog" ej-dialog e-title="Dialog" e-contenturl="iframecontent.html" e-contenttype="iframe" ></div>
Image
We can also load an image as the content by setting the e-contenttype property as image
<div id=”dialog” ej-dialog e-title=”Dialog” e-contenturl=” http://js.syncfusion.com/demos/web/content/images/twitter.jpg” e-contenttype=”image” ></div>