我正在使用ionic来显示模态,这是我的示例代码:
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();
};
当我运行我的代码时,收到错误消息TypeError: Cannot call method 'fromTemplateUrl' of undefined
。我该如何解决?
答案 0 :(得分:4)
$ionicModal
$scope
.controller('myController', ['$scope','$ionicModal', function($scope,$ionicModal){