My Angular directive functions as a login popup, opening a popup page when triggered.
modal = angular.module('Directive.Modal',[]);
modal.directive('modalLogin',function()
{
return {
restrict: 'EA',
scope:true,
scope :
{
header : "=",
callback : "&",
email : "=",
password : "=",
button : "=",
show : "&"
},
templateUrl: 'directiveTemplate/modalWelcome.html',
link : function(scope,element,attrs)
{
scope.$watch("show",function()
{
console.log("Inner Function Clicked");
});
}
}
});
Upon integrating bootstrap.ui, I discovered that I could easily call modals with a one-liner directly from my controllers. I am interested in achieving this method, to create modals or custom modals using a single line from controllers.
The HTML code snippet is as follows:
<!-- Login PopUP Modal Directive -->
<modal-login
header="ModalPageHeader"
email="ModalPageEmail"
password="ModalPagePass"
button="ModalPageButton"
ng-click="getAuth()"
></modal-login>
The controller code snippet is:
app.controller('indexGlobalCtrl', function($scope,$location,ngDialog) {
$scope.ModalPageHeader ="Login Page";
$scope.ModalPageEmail ="Username As E-Mail";
$scope.ModalPagePass = "Password";
$scope.ModalPageButton = "Login";
$scope.getAuth = function()
{
alert("sd");
$scope.show = !$scope.show;
};
}
I have created this directive with the intention of using a one-liner API to toggle the modal. Any guidance on how to programmatically control it would be greatly appreciated.
Thank you for any assistance provided.