我将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,但没有ng-model使用我的变量绑定test。显然,它将 swal 模态代码放在我ng-controller的 html 代码中。
如何使我的变量test与 AngularJS 和 SweetAlert 一起工作?