I am trying to open a new dialog box which contains a text box where i'll enter the name but when this confirm box is shown the text box is disabled.
Edit
I have a page where i have a button for uploading files. When this button is clicked a bootstrap modal popup is opened where i choose file and upload it to node server backend. After successful upload of file a ngDialog confirm is opened where i have a textbox to enter group name. Problem is when this confirm box is shown the text box is disabled.
My controller code:
myApp.controller('UploadFile',['Upload','$window','ngDialog','$scope',function(Upload,$window, ngDialog, $scope){
var vm = this;
vm.submit = function(){ //function to call on form submit
if (vm.upload_form.file.$valid && vm.file) { //check if from is valid
vm.upload(vm.file); //call upload function
}
}
vm.upload = function (file) {
Upload.upload({
url: '/upload', //webAPI exposed to upload the file
data:{file:file} //pass file as data, should be user ng-model
}).then(function (resp) {
if(resp.data.error_code === 0){
console.log(resp.data.path);
$scope.filePath = resp.data.path;
ngDialog.openConfirm({ template: 'secondTemplate',scope: $scope, closeByDocument : false,controller: 'sendUploadDetailsCtrl' })
.then(function(value){//when confirm button is clicked.
console.log("sent Successfully.");
console.log(value);
}, function(error){//Cancel button is clicked.
console.log(error);
});
} else {
$window.alert('an error occured');
}
}, function (resp) { //catch error
console.log('Error status: ' + resp.status);
$window.alert('Error status: ' + resp.status);
}, function (evt) {
console.log(evt);
});
};
}]);
And here is the template:
<script type="text/ng-template" id="secondTemplate">
<div ng-controller="sendUploadDetailsCtrl">
<div class="modal-header">
<h3>Please enter Group name!</h3>
</div>
<div class="modal-body">
<div>{{filePath}}</div>
<input type="text" name="groupName" id="groupName" ng-model="uploadGroupName" required />
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">Submit</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
Now every thing is working fine except textbox inside the controller. ngDialog confirm box is opening. it is showing the scope file path value but the text box is kind of readonly. i can't input any value in it. i don't know what's the problem.