我似乎无法将 ngDialog 与 angular 一起使用。这是我的代码
折扣模态函数
$scope.discountModalOpen = function () {
ngDialog.open({
template: 'views/discountModal.html',
controller: 'ModalInstanceCtrl',
scope: $scope
});
};
discountModal 的控制器
angular.module('myApp')
.controller('myProductsCtrl',
['$scope', '$stateParams', 'productService', '$modal','ngDialog', '$filter','$location',
function ($scope, $stateParams, productService, $modal, $filter,ngDialog, $location) {
});
应用程序.js
angular
.module('myApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngSanitize',
'ngTouch',
'restangular',
'ui.router',
'ui.bootstrap',
'angularMoment',
'timer',
'ngMessages',
'ngDialog'
])
我的 javascript 控制台中仍然出现以下错误
TypeError: ngDialog.open is not a function at Scope.$scope.discountModalOpen ( http://localhost:9000/scripts/controllers/myProductsCtrl.js:293:18 ) at fn (eval at ( http://localhost:9000 /bower_components/angular/angular.js:13231:15 ), :4:242) 在http://localhost:9000/bower_components/angular-touch/angular-touch.js:478:9 在 Scope.$get.Scope .$eval ( http://localhost:9000/bower_components/angular/angular.js:15916:28 ) 在 Scope.$get.Scope.$apply ( http://localhost:9000/bower_components/angular/angular.js :16016:25 ) 在 HTMLButtonElement。( http://localhost:9000/bower_components/angular-touch/angular-touch.js:477:13 ) 在 HTMLButtonElement.jQuery.event.dispatch (http://localhost:9000/bower_components/jquery/dist/jquery.js:4435:9)在 HTMLButtonElement.jQuery.event.add.elemData.handle (http://localhost:9000/bower_components/jquery/dist/jquery .js:4121:28 )