$ionicModal doesn't open, returns undefined!

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();

}

I believe this is an issue with the path of the templateurl

‘templates/modal.html’

Try like the following

$ionicModal.fromTemplateUrl(‘app/common/directives/aaa/aaa.html’, {
scope: $scope,
animation: ‘slide-in-up’
}).then(function(modal) {
$scope.modal = modal;
});

yes this is the problem with the url. I am using script for the modal and ng-template.