Hello,
I am trying to create a modal on click, I’ve tried the code earlier and it was working, now trying it in new project and getting this error:
TypeError: Cannot read property ‘show’ of undefined
at Scope.$scope.openModal (controllers.js:64)
at fn (eval at compile (ionic.bundle.js:27615), :4:288)
at ionic.bundle.js:65290
at Scope.$eval (ionic.bundle.js:30372)
at Scope.$apply (ionic.bundle.js:30472)
at HTMLDivElement. (ionic.bundle.js:65289)
at defaultHandlerWrapper (ionic.bundle.js:16764)
at HTMLDivElement.eventHandler (ionic.bundle.js:16752)
at triggerMouseEvent (ionic.bundle.js:2953)
at tapClick (ionic.bundle.js:2942)
here is the code:
$ionicModal.fromTemplateUrl(‘templates/modal.html’, function($ionicModal) {
$scope.modal = $ionicModal;
}, {
scope: $scope,
animation: ‘slide-in-up’
});
$scope.openModal = function(scode) {
$scope.mcode = scode; $scope.modal.show();
}