![](/img/trans.png)
[英]Fade out spinner right before data are binded to scope in Angular JS
[英]Showing the bootbox with the angular js data binded form
我仅在两周前开始使用Angular JS,它的数据绑定功能让我非常惊讶。
我也非常喜欢使用bootboxjs向用户显示消息和所有信息。
我只是想我们可以通过自定义对话框在启动箱中显示Angular JS的数据绑定形式。
我试过了,但实际上我没有得到内容,对话框将按原样显示模板,而不显示数据。
我们如何在Bootbox UI中显示已绑定数据的数据。
您必须使用$ compile。
http://code.angularjs.org/1.2.13/docs/guide/compiler
例如:
var tplCrop = '<div><img ng-src="{{file.src}}"/></div>';
var template = angular.element(tplCrop);
var linkFn = $compile(template);
var html= linkFn($scope);
bootbox.dialog({
message: html,
title: "My title",
buttons: {
ok: {
label: "Ok",
className: "btn-success",
callback: function () {
}
},
close: {
label: "Close",
className: "btn-danger",
callback: function () {
}
}
}
});
我建议您使用这个非常好的示例Plunker如何将数据传递给Dialog。
但是,它不是bootbox(使用jQuery)。 该演示显示仅基于bootstrap和angualrJS的对话框。
希望对你有帮助
现在有一个非常好的模块,可以使用单独的模板文件来处理它! https://github.com/eriktufvesson/ngbootbox
非常好!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.