I want to send response getting from the back-end to dialog box, when I click on OK then it will redirect to home page. Same like when we use alert to show response.
It is like,I am updating some employee information , after updating, I will give some response like updated_date and updated_by. I want to show these information on dialog box. When I click on OK button, it will redirect to home page, where all employees listed.
So my question is how to send response to dialog template. I following code I am use alert to show response, but need some dialog window to pop-up like demo
Dialog template
<div class="modal-body">
{{text}}
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">OK</button>
</div>
In my main controller I am getting response like
$scope.getInfo=function(){
var empData={some info}
$http.post(api,empData)
.success(function(response, status){
alert(response);
$state.go("home");
});
}
Here I am using alert to show the response, instead of alert I want to use dialog box some thing like this
You may benefit from using the angular-ui-bootstrap framework, which implements a modal component along many UI components.
That's what the plunker you linked does, by including //angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.0.js
and //netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css
.
You can use the lib ngDialog
http://likeastore.github.io/ngDialog/
Open a dialog :
var dialog = ngDialog.open({
template: 'externalTemplate.html'
});
dialog.closePromise.then(function (data) {
console.log(data.id + ' has been dismissed.');
});
Template :
<script type="text/ng-template" id="externalTemplate.html">
<div class="dialog-contents">
<input type="text"/>
<input type="button" value="OK" ng-click="checkInput() && closeThisDialog('Some value')"/>
</div>
</script>
将后端值分配给您在.success函数中使用的模态变量$ scope.text = empdata;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.