【发布时间】:2018-04-27 11:19:23
【问题描述】:
我将SweetAlert2 与 AngularJS 一起使用,将此端口用于 AngularJS 1.x:https://github.com/socialbase/angular-sweetalert-2。
我正在尝试在我的 swal 中添加一些自定义 html,所以当我这样做时:
angular.module('app').controller('TestController', function($scope, SweetAlert) {
$scope.test = "My test";
SweetAlert.swal({
type: 'warning',
html: '<input type="text" ng-model="test">'
}).then(function() {
});
});
它正确绑定了 html,但没有使用我的变量 test 绑定 ng-model。显然,它将 swal 模态代码放在我的 ng-controller 之外的我的 html 代码中。
如何使我的变量 test 与 AngularJS 和 SweetAlert 一起使用?
【问题讨论】:
-
你确定那个库完全支持这个功能吗?
-
我查看了github.com/socialbase/angular-sweetalert-2 代码,它只是 SweetAlert2 到 AngularJS 1.x 的一个端口,所以我认为这个库可以在其中使用 AngularJS,但可能是这样不支持。
标签: angularjs sweetalert2