angularjs - ionicModal Cannot call method 'fromTemplateUrl' of undefined -
i using ionic display modal, here example code:
angular.module('starter', ['ionic']) .controller('mycontroller', ['$scope', function($scope,$ionicmodal){ $ionicmodal.fromtemplateurl('my-modal.html', { scope: $scope }).then(function(modal) { $scope.modal = modal; }); $scope.openmodal = function() { $scope.modal.show(); };
when run code, got error message saying typeerror: cannot call method 'fromtemplateurl' of undefined
. how can fix it?
you missed $ionicmodal
after $scope
.controller('mycontroller', ['$scope','$ionicmodal', function($scope,$ionicmodal){
Comments
Post a Comment