我正在开发一个离子应用程序,我已经为ionic confirm popup编写了一个 angularjs 服务,
服务
app.factory("PopupSer", ["$rootScope", "$ionicPopup",
function ($rootScope, $ionicPopup) {
return {
delete: function () {
$rootScope.popup = $ionicPopup.confirm({
title: 'Delete Title',
cssClass: '',
subTitle: '',
template: '',
templateUrl: '',
cancelText: 'No',
cancelType: '',
okText: 'Yes',
okType: 'button-balanced'
});
}, // delete
hide: function () {
$rootScope.popup.hide();
}
}; // return
}
]);
现在,我想在我的控制器中更改(例如)confirm title、cancelText或okText,如下所示:
控制器
PopupSer.delete({
title: 'Are You Sure About That?'
});
当我在控制器中调用服务时,我该怎么做?