Can't use ngDialog due to TypeError: ngDialog.open is not a function at Scope.$scope.discountModalOpen?
Can't use ngDialog due to TypeError: ngDialog.open is not a function at Scope.$scope.discountModalOpen?
我似乎无法将 ngDialog 与 angular 一起使用。这是我的代码
discountModal 函数
$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) {
});
app.js
angular
.module('myApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngSanitize',
'ngTouch',
'restangular',
'ui.router',
'ui.bootstrap',
'angularMoment',
'timer',
'ngMessages',
'ngDialog'
])
我的 javascript 控制台仍然出现以下错误
TypeError: ngDialog.open 不是函数
在范围内。$scope.discountModalOpen (http://localhost:9000/scripts/controllers/myProductsCtrl.js:293:18)
在 fn(在(http://localhost:9000/bower_components/angular/angular.js:13231:15)评估,:4:242)
在 http://localhost:9000/bower_components/angular-touch/angular-touch.js:478:9
在范围内。$get.Scope.$eval (http://localhost:9000/bower_components/angular/angular.js:15916:28)
在范围内。$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)
我敢说问题是您的注射剂顺序错误:
angular.module('myApp')
.controller('myProductsCtrl',
['$scope', '$stateParams', 'productService', '$modal','ngDialog', '$filter','$location',
function ($scope, $stateParams, productService, $modal, ngDialog, $filter, $location) {
});
您已将 ngDialog
注入 $filter
,反之亦然。
我似乎无法将 ngDialog 与 angular 一起使用。这是我的代码
discountModal 函数
$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) {
});
app.js
angular
.module('myApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngSanitize',
'ngTouch',
'restangular',
'ui.router',
'ui.bootstrap',
'angularMoment',
'timer',
'ngMessages',
'ngDialog'
])
我的 javascript 控制台仍然出现以下错误
TypeError: ngDialog.open 不是函数 在范围内。$scope.discountModalOpen (http://localhost:9000/scripts/controllers/myProductsCtrl.js:293:18) 在 fn(在(http://localhost:9000/bower_components/angular/angular.js:13231:15)评估,:4:242) 在 http://localhost:9000/bower_components/angular-touch/angular-touch.js:478:9 在范围内。$get.Scope.$eval (http://localhost:9000/bower_components/angular/angular.js:15916:28) 在范围内。$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)
我敢说问题是您的注射剂顺序错误:
angular.module('myApp')
.controller('myProductsCtrl',
['$scope', '$stateParams', 'productService', '$modal','ngDialog', '$filter','$location',
function ($scope, $stateParams, productService, $modal, ngDialog, $filter, $location) {
});
您已将 ngDialog
注入 $filter
,反之亦然。