No idea what is happening with my Meanjs based app. In my localhost works fine with no error but when I deploy to Heroku, this error appears the console. I've tried many things but cant figure it out because the info is very few. Cant understand what kind of dependency is causing the problem. It just happened whe I had to show the test to the employer.. very sad with heroku... any other place like heroku to deploy a meanjs app? Thanks!
Link with: Meanjs app in Heroku
Are you using the inline array annotation for dependencies injection?
This is what i mean:
someModule.controller('MyController', ['$scope', 'greeter', function($scope, greeter) {
// ...
}]);
If you don't, Heroku will minify your scripts, renaming your dependencies' names and let Angular throw the $Injector error.
Related
I've got some issue for 2 days, it's getting on my nerve, if someone now how to fix this it will be very helpfull :
I've got a ionic 1 project, that I have to do some update, but nothing seems to work...
when i do ionic serve, and i look the console of the navigatori got :
Uncaught TypeError: angular.module(...).info is not a function
and
ReferenceError: Connection is not defined
at Object.isOnline
i'm stuck on the entry page and ng-src ng-click seems to not working.
I've look many post but nothing seems to resolve my problem.
Not all your angular scripts are the same version. .info was introduced recently, you might have angular files with different version.
Refer to related angular issue.
https://github.com/angular/angular.js/issues/15786
I got something like this :
Uncaught TypeError: angular.module(...).info is not a function
at angular-resource.js:445
at angular-resource.js:858
angular-resource.js:445:
angular.module('ngResource', ['ng']).
info({ angularVersion: '1.6.4' }).
provider('$resource', function ResourceProvider() {
var PROTOCOL_AND_IPV6_REGEX = /^https?:\/\/\[[^\]]*][^/]*/;
at angular-resource.js:858:
})(window, window.angular);
It appears that I can't ionic serve, that app, but I can cordova build android, on the computer that has develops it , but not on my computer which I develops ionic 2 project.
I don't know if this is from my npm, node, cordova version or if is something completly diferent.
I was following a tutorial for creating a MEAN stack project with Google Maps integration. I finished the project without any problems, thus, I stopped working on it. When I came back to check on it, it just doesn't work anymore. I didn't change anything with the code. I even pulled a previously working commit from my repository but the error
[$injector:modulerr] http://errors.angularjs.org/1.2.25/$injector/modulerr?p0=scotchApp&p1=Error…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.25%2Fangular.min.js%3A18%3A387)
is still there. I really don;t have an idea what went wrong because this was previously working fine. I hope someone could help.
EDIT. Here's a part of the 'gservice' service of my project.
// Creates the gservice factory.
// This will be the primary means by which we interact with Google Maps
angular.module('gservice', [])
.factory('gservice', function($rootScope, $http) {
The problem is here: components.html
<!-- Client Scripts -->
<script src="../app/client/routes/script.js"></script>
<script src="../app/client/service/gservice.js"></script>
<script src="../app/client/service/aservice.js"></script>
Your scotchApp module is defined in script.js as:
var scotchApp = angular.module('scotchApp', ['ngRoute',
'ngCookies',
'controllerStoreDetail', 'controllerStoreCategory',
'controllerStoreQuery', 'controllerUserDetail',
'controllerUserAuthentication', 'geolocation',
'gservice', 'aservice',
'datatables'
]);
It has a dependency on gservice, aservice etc. But those files are loaded after script.js. So while loading your module (script.js), angular is not able to find definition for those services. You need to make sure that all dependencies are loaded before script.js.
#devqon had asked this question:
Is your js file which declares the gservice module included before the
js file which declares the scotchApp module?
To which you answered:
#devqon Yes it is. I really find this case weird as it was really working perfectly for weeks until now.
Which doesn't seem to be the case.
Rectify the sequence in which you are loading JS files and the error will be gone.
I fixed the problem. The cause was a missing 'v=3' in the src of the script for loading the Google Maps API. I still don't why that's the case as the project was previously working properly.
Currently working on a angular app where I have my application specific angular modules under folder App.
Using Visual Studio extension - Web Essential 2012, created a javascript bundle file for local angular modules and related files(controllers, directives, services) into app.all.js.bundle files under App folder.
Structure looks now like :
Now, when I use app.all.js into my index.html application works fine for me, however when change to `app.all.min.js, I am getting following error:
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=app&p1=Error%3A%20%…0g%20(http%3A%2F%2Flocalhost%3A59405%2FScripts%2Fangular.min.js%3A39%3A222) angular.js:38
when using app.all.min.js I am switching angular.js to angular.min.js.
Do I need to do anything more?
make sure you are injecting the dependency service and controller properly.
myApp.controller('GreetingController', ['$scope', function($scope) {
$scope.greeting = 'Hola!';
}]);
I am going through the Strongloop documentation. In the tutorial Add a client app I followed the steps that are given. I am able to run the app with slc run without error. But when checked in the browser there is error that angular is not defined in app.js.
In case if I include angular.js from google i.e. just uncomment in app.js
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.4/angular.min.js"></script>
There is error on browser:
Error: [$injector:modulerr] .....
So what could have gone wrong?
The example is outdated, we have a new tutorial here: https://github.com/strongloop/loopback-getting-started. Let me know if that helps.
I working with Laravel 5 and Angularjs, Laravel 5 uses Gulp for schedule asset's task and all work fine when use gulp's command, but when I use gulp --production's command and gulp minimize the Angularjs library, the console's chrome output:
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:unpr] Unknown provider: e
Below my code:
gulpfile.js
First step, I copy all javascripts from bower folder to assets/js
.copy(
'resources/assets/bower_resources/angular/angular.js',
'resources/assets/js/vendor/angular.js')
.copy(
'resources/assets/bower_resources/angular-bootstrap/ui-bootstrap.js',
'resources/assets/js/vendor/ui-bootstrap.js')
.copy(
'resources/assets/bower_resources/ng-busy/src/angular-busy.js',
'resources/assets/js/vendor/angular-busy.js')
.copy(
'resources/assets/bower_resources/angular-ui-notification/dist/angular-ui-notification.js',
'resources/assets/js/vendor/angular-ui-notification.js')
second step, I put together all libraries copied inside one file "libraries.js"
.scripts(['vendor/angular.js',
'vendor/ui-bootstrap.js',
'vendor/angular-busy.js',
'vendor/angular-ui-notification.js',
'app.js'],'public/scripts/libraries.js')
My app.js
var app = angular.module('app', ['ui.bootstrap','ngBusy','ui-notification']);
app.config(function ($interpolateProvider) {
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
});
I try different combination, but not working.
Please help!
Have you tried using inline annotation for dependency injection?
Here's a previous question that solves this problem
"Uncaught Error: [$injector:unpr]" with angular after deployment