作者:卢军好2602912493 | 来源:互联网 | 2023-08-14 16:58
IamtryingtousengMessagesinmycontroller:我试图在我的控制器中使用ngMessages:Iamsettingupmyrequire.
I am trying to use ngMessages in my controller:
我试图在我的控制器中使用ngMessages:
I am setting up my require.js config:
我正在设定我的要求。js配置:
require({
// libraries dependencies (fallback support)
paths: {
jquery: [
'vendor/jquery/2.1.3/jquery.min'
],
bootstrap: [
'vendor/bootstrap/3.3.2/js/bootstrap.min'
],
angular: [
'vendor/angular.js/1.3.11/angular.min'
],
angularResource: [
'vendor/angular.js/1.3.11/angular-resource.min'
],
angularAnimate: [
'vendor/angular.js/1.3.11/angular-animate.min'
],
ngMessages: [
'vendor/angular.js/1.3.11/angular-messages.min'
],
uiBootstrap: [
'vendor/angular-ui/bootstrap/0.12.0/ui-bootstrap-tpls.min'
],
uiRouter: [
'vendor/angular-ui/ui-router/0.2.13/angular-ui-router.min'
],
},
// define js scripts dependencies
shim: {
'bootstrap': {
deps: ['jquery']
},
'angular': {
deps: ['bootstrap'],
exports: 'angular'
},
'angularResource': {
deps: ['angular']
},
'angularAnimate': {
deps: ['angular']
},
'ngMessages': {
deps: ['angular']
},
'uiBootstrap': {
deps: ['bootstrap', 'angular']
},
'uiRouter': {
deps: ['angular']
},
},
priority: [
'angular'
],
deps: ['./ng.app']
});
and in module.js I am requiring ngMessages:
和模块。我需要ngMessages:
define(function(require) {
'use strict';
var angular = require('angular');
require('angularResource');
require('ngMessages');
require('uiRouter');
require('uiBootstrap');
// angular module definition
return angular.module(
// module name
'companies',
// module dependencies
[
'ngResource',
'ngMessages',
'ui.router',
'ui.bootstrap',
require('shared/fend/input-utils/package').name,
require('shared/fend/pagination/package').name
]
);
});
and then in my controller I am trying to inject ngMessages:
然后在我的控制器中,我试图注入ngMessages:
define(function(require) {
'use strict';
var module = require('../module');
require('../resources/rest');
module.controller('CompaniesNewCtrl', CompaniesNewCtrl);
CompaniesNewCtrl.$inject = [
'$rootScope', '$scope', '$state',
'CompaniesResource',
'InputFocusFactory', 'ngMessages'
];
function CompaniesNewCtrl($rootScope, $scope, $state, resource, input, ngMessages) {... })
but i am getting error:
但我犯了一个错误:
Error: $injector:unpr Unknown Provider Unknown provider: ngMessagesProvider
错误:$injector:unpr未知提供者未知提供者:ngMessagesProvider
What am I doing wrong?
我做错了什么?
1 个解决方案