var myapp = angular.module('myapp', []);
myapp.config(function($interpolateProvider) {
$interpolateProvider
.startSymbol('{[')
.endSymbol(']}');
});
myapp.controller('CanvasControls', function($scope) {
function1($scope);
function2($scope);
});
This code integrate with rails and working in development fine but in production mode it gives below errors.
Failed to instantiate module myapp due to:
由于以下原因无法实例化模块myapp:
Uncaught Error: $injector:modulerr
/$injector/modulerr?p0=myapp
2 个解决方案
#1
1
working in development fine but in production mode it gives below errors
在开发中工作正常但在生产模式下它会产生以下错误
Guess in production you are compressing the code.And I presume you have to add $scope
like this Hope this will help
在生产中猜猜你正在压缩代码。我认为你必须添加这样的范围希望这会有所帮助
// Changed here Added String '$scope'
myapp.controller('CanvasControls',['$scope', function($scope) {
function1($scope);
function2($scope);
}]);
EDIT
If you have not modified the .config part please try by making following change.
如果您尚未修改.config部分,请尝试进行以下更改。
customInterpolationApp.config(['$interpolateProvider', function($interpolateProvider){
$interpolateProvider.startSymbol('//');
$interpolateProvider.endSymbol('//');
}]);
More about such error
更多关于这样的错误
#2
1
Syntax error added extra ]
in controller
控制器中的语法错误添加额外]
myapp.controller('CanvasControls', function($scope) {
function1($scope);
function2($scope);
}]);// remove ']' from here
or use mini-fist way
或使用迷你拳头方式
myapp.controller('CanvasControls', ['$scope',function($scope) {
function1($scope);
function2($scope);
}]);
and you may mismatch module name myapp
in controller and in html ng-app="myapp"
并且您可能在控制器和html ng-app =“myapp”中将模块名称myapp不匹配
#1
1
working in development fine but in production mode it gives below errors
在开发中工作正常但在生产模式下它会产生以下错误
Guess in production you are compressing the code.And I presume you have to add $scope
like this Hope this will help
在生产中猜猜你正在压缩代码。我认为你必须添加这样的范围希望这会有所帮助
// Changed here Added String '$scope'
myapp.controller('CanvasControls',['$scope', function($scope) {
function1($scope);
function2($scope);
}]);
EDIT
If you have not modified the .config part please try by making following change.
如果您尚未修改.config部分,请尝试进行以下更改。
customInterpolationApp.config(['$interpolateProvider', function($interpolateProvider){
$interpolateProvider.startSymbol('//');
$interpolateProvider.endSymbol('//');
}]);
More about such error
更多关于这样的错误
#2
1
Syntax error added extra ]
in controller
控制器中的语法错误添加额外]
myapp.controller('CanvasControls', function($scope) {
function1($scope);
function2($scope);
}]);// remove ']' from here
or use mini-fist way
或使用迷你拳头方式
myapp.controller('CanvasControls', ['$scope',function($scope) {
function1($scope);
function2($scope);
}]);
and you may mismatch module name myapp
in controller and in html ng-app="myapp"
并且您可能在控制器和html ng-app =“myapp”中将模块名称myapp不匹配