I've been working with AngularJS to upgrade our project's version from 1.2.16 to 1.6.4. Since we are using bower as package manager, I've updated the necessary parts of bower.json as below:
{
"name": "takademi",
"version": "0.0.0",
"dependencies": {
"angular": "1.6.4",
"json3": "~3.3.1",
"es5-shim": "~3.1.0",
"angular-cookies": "1.6.4",
"angular-sanitize": "1.6.4",
"angular-animate": "1.6.4",
"angular-route": "1.6.4",
"angular-bindonce": "~0.3.1",
"restangular": "~1.4.0",
"angular-base64": "~2.0.2",
"lodash": "~2.4.1"
},
"devDependencies": {
"angular-mocks": "1.2.16",
"angular-scenario": "1.2.16"
},
"appPath": "app"
}
After this update, I ran the project. Now I am able to see angular's version as 1.6.4 but I got below error:
*** process.env.ENV is not defined, assuming 'prod' env
t @ bundle.js:4776
angular.js:14525 TypeError: Cannot read property '$$state' of undefined
at then (angular.js:16799)
at addPromiseLikeThing (angular-busy.js:67)
at angular-busy.js:22
at Object.forEach (angular.js:403)
at Object.tracker.reset (angular-busy.js:18)
at angular-busy.js:175
at $watchCollectionAction (angular.js:17859)
at Scope.$digest (angular.js:17999)
at Scope.$apply (angular.js:18269)
at done (angular.js:12387)
(anonymous) @ angular.js:14525
getMarketPlace Failed to load resource: the server responded with a status of 401 (Unauthorized)
angular.js:14525 Possibly unhandled rejection: {"data":{"status":401,"module":0,"code":1000,"message":"AUTHENTICATION_REQUIRED","develo perMessage":null,"moreInfo":null},"status":401,"config": {"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","params":{"v":967},"headers":{"Accept":"application/json, text/plain, */*"},"url":"/portal/rest/market-place/getMarketPlace"},"statusText":"Unauthorized"}
(anonymous) @ angular.js:14525
(anonymous) @ angular.js:11008
processChecks @ angular.js:16860
$digest @ angular.js:17971
$apply @ angular.js:18269
done @ angular.js:12387
completeRequest @ angular.js:12613
requestLoaded @ angular.js:12541
As far as I understood, it simply states that my newly upgraded AngularJS 1.6.4 file doesn't support $$state
keyword usage in it. Instead of showing files that we've developed, the error comes from Angular's own file.
Here is the function that chrome browser navigates me to show the error - 16799th line of angular.js:
function Promise() {
this.$$state = { status: 0 };
}
extend(Promise.prototype, {
then: function(onFulfilled, onRejected, progressBack) {
if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {
return this;
}
var result = new Promise();
this.$$state.pending = this.$$state.pending || [];
this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
return result;
},
'catch': function(callback) {
return this.then(null, callback);
},
'finally': function(callback, progressBack) {
return this.then(function(value) {
return handleCallback(value, resolve, callback);
}, function(error) {
return handleCallback(error, reject, callback);
}, progressBack);
}
});
I've made a search in SO and Google it a little bit, but I couldn't find any related posts or explanations to my problem. Most of the answers are related to Ruby, or react:
angular showing TypeError: Cannot read property 'state' of undefined
Uncaught TypeError: Cannot read property 'state' of undefined
react: uncaught TypeError: Cannot read property 'state' of undefined
Since I am not aware of the whole features of AngularJS and bower, those answers aren't clear for me.
Can you guys give me a hand on this?
Thanks in advance!