Migration from Angular 1.3 to 1.5 - angularjs

I am getting the error that says
angular.js:13236 Error: [ng:areq] Argument 'fn' is not a function, got undefined
http://errors.angularjs.org/1.5.0/ng/areq?p0=fn&p1=not%20aNaNunction%2C%20got%20undefined
at http://localhost:3000/bower_components/angular/angular.js:68:12
at assertArg (http://localhost:3000/bower_components/angular/angular.js:1825:11)
at assertArgFn (http://localhost:3000/bower_components/angular/angular.js:1835:3)
at Promise.promise.error (http://localhost:3000/bower_components/angular/angular.js:10979:11)
at Object.getUserChannels (http://localhost:3000/scripts/services/media-service.js:38:37)
at activate (http://localhost:3000/scripts/controllers/player-controller.js:63:22)
at new <anonymous> (http://localhost:3000/scripts/controllers/player-controller.js:28:9)
The controller and factory worked before the migration, I cant find any documentation that shows any changes to factories. To me it looks like the controller cannot find the function is the mediaSVC file

Did you check if you used lazy loading of your services and factories in 1.3? If so, please make sure they're loaded in advance before you start calling them when you migrated to 1.5. This was one of the things I've experienced when migrated the large enterprise app from 1.4 to 1.5:
http://www.diatomenterprises.com/migration-history-from-angularjs-1-3-to-1-5-and-then-2-0/
The lazy loading may require a bit of attention and another small library to let it work correctly in 1.5. I can assist you if the problem still exists.

Related

pns_confirmRegex of undefined

I'm running a deployment to heroku, I'm unable to produce this locally, but I'm getting this error:
Uncaught TypeError: Cannot read property 'pns_confirmRegex' of undefined
at Object.i [as check] (h1.js:150)
at HTMLDocument.<anonymous> (h1.js:62)
at l (h1.js:48)
at c (h1.js:48)
Like I know there's an undefined item somewhere... and if you look at the sources, it's coming from something of h1.js .
I'm using react with some service workers in the front-end and they are all transpiled together with webpack. Does anyone have any idea what this might be?
Check the stack trace very carefully and you should see that this probably has to do with https://github.com/facebook/react-devtools/issues/461.
I had the same error and uninstalled Honey. If you click on the links in the stack trace you should be able to look at the code and see a bunch of Regex selectors that Honey seems to employ.
Disable Honey Chrome extension and cures the issue. Thank you Yehuda M. Makarov

'Uncaught TypeError: angular.module(...).run(...) is not a function' in Grunt minified js-file

My code works on development mode, uncompressed. But when I use grunt's minify functionality and run the app in production mode, I get that error: Uncaught TypeError: angular.module(...).run(...) is not a function.
When I look into the error in Google Chrome Developer Tools, I get what you see in the screenshot. Does anybody understand where the problem is?
I am using Angular 1.4+ in Angular-Fullstack. The error occurs in vendor.{{randomstring}}.js.
Thanks for any support!
You have 2 issues here.
Dependency injection. You can edit manually the archives or use https://github.com/mgol/grunt-ng-annotate this will do this automagically for you.
Concatenation. Check this grunt plugin https://github.com/gruntjs/grunt-contrib-concat the issue here is javascript dont understand when a function end/start because dont have a separation mark, check where the error is.
})(function(a,b) {
It should be:
});(function(a,b) {
Check the "Concatenating with a custom separator" example of grunt-contrib-concat

Migrating from Angular 1.2.14 to 1.4.2 breaks whole application

I have angular App defined with following:
var myApp = angular.module('myApp', ['ngRoute','infinite-scroll','geolocation', 'ngAnimate', 'ngTouch','ui.filters', 'AxelSoft','angularLazyImg','wu.masonry','ui.bootstrap','ngSanitize']);
Until now I was using AngularJS version 1.2.14. Now I need to use AngularJS form validations and in order to do that, I have decided to migrate to Angular's latest stable version 1.4.2.
When I have changed the angular version, things got broke and console throws
Uncaught Error: [$injector:modulerr] with following stack trace :
Error: $injector:modulerr
Module Error
Failed to instantiate module myApp due to:
TypeError: Cannot read property 'push' of undefined
at http://localhost:8000/static/mobile/js/angularApp/app.js:6:37
at Object.e [as invoke] (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:39:156)
at d (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:328)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:452
at m (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:7:322)
at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:229)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:398
at m (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:7:322)
at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:37:229)
at eb (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js:40:503
I have tried reading and understanding angularJS official migration guide but I coudn't able to figure out what's in it for me as I haven't used $animate in my code(It $animate and $touch are injected only for another plugin to work i.e. sliders and also I have used 'ngROute anywhere')
Does anyone have idea what should be done here as I have no idea about where do I start :)
So here is what was needed to be done to migrate my angular Application.
Migrate ngRoute and ngAnimate with the same version of angular
Remove HTTP interceptors which was in 1.2 and change them to the style of angular 1.4
In my case, removing $httpProvider and migration ngAnimate and ngRoute had solved my problem.

Error: [$injector:unpr] Unknown provider: $$rAFProvider

Using Karma to test Angular getting error:
Error: [$injector:modulerr] Failed to instantiate module ngMock due to:
Error: [$injector:unpr] Unknown provider: $$rAFProvider
Angular mock, Angular versions error?
I've heard solutions detailing changing of angular-mock version or angular version--which seems like a bad idea since I'd like to test on the same version as the app starts with.
Anyone else have an error like this?
Please check your angular version.
Your angular version and angular-mock version must be same.
To download angular-mock go the below link and replace the X.Y.Z with your angular version and save it
http://ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-mocks.js
for example my angular version is 1.2.9
This work for me .
This issue was resolved by making sure the rails asset pipeline, which provides the angular-related assets in my case, was correctly serving assets during testing.

Angular Routing - Error: [ng:areq]

I'm trying to build an application with Angular but I've run into an error that I'm unsure how to resolve. It seems to have something to do with the routing that I have set up.
As soon as the page loads it is forced by the routing to go to the first view, which is what I want it to do, but it is throwing a weird error...
Error: [ng:areq] http://errors.angularjs.org/1.2.19/ng/areq?p0=LoginController&p1=not%20aNaNunction%2C%20got%20undefined
at Error (native)
The best way I could get your hands on my code is to load it into GitHub. You can find my repository here...
https://github.com/JosephEricDavis/TimeTrack
It's pretty simple and strait forward so far. Not a lot of code to dig through yet. Can anybody see what I'm doing wrong?
Thanks
Well, that's pretty embarrassing. As miqid mentioned in the comment, I had forgotten to include script tag references to my controller files.

Resources