I want to load data in modal (ui.bootstrap.modal) with the help of angularJs.For Example i send request through post method and data retrieve successfully and now i want to load it into modal.Here is my code
var MainAdmin = angular.module('MainAdmin', ['ui.bootstrap']);
function MainAdminController($scope, $http, $modal) {
$scope.LoadTypesView = function() {
$http({
method : 'POST',
url : 'load.php',
data : dataArray,
headers : { 'Content-Type': 'application/json' }
})
.success(function(data) {
if(data.result.status=="success")
{
$scope.Type = data.result.response; // Type is an array which is defined.
$modal.open({
templateUrl: 'UserTypeModal.html',
backdrop: true,
windowClass: 'modal',
controller: function ($scope, $modalInstance, $log, Type) {
$scope.SubmitUserType = function () {
$modalInstance.dismiss('cancel');
}
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}
});
}
});
};
}
Here is my HTML
<h1><a href="" ng-click="LoadTypesView()">Types</a></h1>
<script type="text/ng-template" id="UserTypeModal.html">
<div class="modal-header">
<h3>Define User Rights</h3>
</div>
<form ng-submit="SubmitUserType()">
<div class="modal-body">
</div>
</form>
<div class="modal-footer">
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
</script>
Kindly provide some example code Thanks in advance