我正在使用离子框架,我已经成功地将fullCalender移植到我的项目中,
我可以在eventClick上调用一个函数,即使它完美地给出了事件标题的警报。
但我的主要目标是打开离子模式,而不是事件标题的alert()。
代码工作,直到警报到来,我是新手离子需要一些想法如何获得this.So远我已经见证了下面的代码
app.js代码:
$scope.calOptions = {
editable : true,
header : {
left: 'prev',
center: 'title,today',
right: 'next'
},
eventClick: function(calEvent, jsEvent, view){
var a=calEvent.description;
var b=calEvent.title;
alert('ALERT-1:' +a );
$scope.safeApply(function()
{
alert('ALERT-2:' + calEvent.description);
$scope.eventModal(a,b)
});
};
$scope.eventModal=function(a,b){
alert('ALERT-3:'+b);
$scope.eventModal.show();
}
$ionicModal.fromTemplateUrl('modal.html', function($ionicModal) {
$scope.eventModal = $ionicModal;
},{
scope: $scope,
// The animation we want to use for the modal entrance
animation: 'slide-in-up'
});更清楚地说,上面的代码显示"eventClick:“一直工作到"ALERT-3”,然而,在事件单击时,它调用函数"$scope.eventModal=function(a,b)“,但在$scope.eventModal.show();的下一行之后,它显示为"show is not a function",我想打开带有传递给"$scope.eventModal=function(a,b)”函数的变量的模式。
需要一个想法,以获得打开的参数传递到"$scope.eventModal=function(a,b)“的模式。
提前谢谢。
发布于 2015-12-10 18:31:44
试着做一些更简单的事情:
eventClick: function(calEvent, jsEvent, view){
$scope.a = calEvent.description;
$scope.b = calEvent.title;
$ionicModal.fromTemplateUrl('modal.html', {
scope: $scope
}).then(function (modal) {
$scope.modal = modal;
$scope.modal.show();
}).catch(function(err){
console.log(err);
});
};在modal中,你可以绑定{{::a}}和{{::b}}或者你想要做的任何事情。
https://stackoverflow.com/questions/34063174
复制相似问题