After changing the angularjs in my application I am getting error - javascript

I developed an application which uses 1.0.1 version : https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js
Now I need to use latest version as to use new functionality so I tried replacing with
https://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.min.js
and I am getting error.
error :
Error: [$injector:modulerr] http://errors.angularjs.org/1.2.11/$injector/modulerr?p0=audiapp&p1=%5B%24injector%3Aunpr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.2.11%2F%24injector%2Funpr%3Fp0%3D%2524routeProvider%0At%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A6%0AYb%2Fl.%24injector%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A32%0Ac%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A30%0Ad%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A30%0AYb%2Fe%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A29%0Aq%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A7%0Ae%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A29%0AYb%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A32%0AXb%2Fc%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A17%0AXb%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A18%0ASc%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A17%0A%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.11%2Fangular.min.js%3A201%0Ax.Callbacks%2Fc%40http%3A%2F%2Flocalhost%3A55165%2FScripts%2Fjquery-1.10.2.min.js%3Fv%3D1.0%3A4%0Ax.Callbacks%2Fp.fireWith%40http%3A%2F%2Flocalhost%3A55165%2FScripts%2Fjquery-1.10.2.min.js%3Fv%3D1.0%3A4%0A.ready%40http%3A%2F%2Flocalhost%3A55165%2FScripts%2Fjquery-1.10.2.min.js%3Fv%3D1.0%3A4%0Aq%40http%3A%2F%2Flocalhost%3A55165%2FScripts%2Fjquery-1.10.2.min.js%3Fv%3D1.0%3A4%0A
https://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.min.js
Line 6
Apart from this I am also using angular-resource.js version v1.0.2 and http://code.angularjs.org/1.2.3/angular-route.min.js.
Can any one please suggest what is wrong here?
All the references :

Related

knockout 3.2.0 vulnerablity error (js dependency) for IE7

I am getting this error :
How to fix this dependency issue ?
In solution it says to use new version .
but is there any other fixes ?
I dont want to change version for some reason

Handlebars error: 'Handlebars is not defined'

I'm new to JS and I have problem in my project. I can't load handlebars. I have the same ReferenceError : handlebars is not defined. I've tried also adding handlebars.js file in src folder but it doesn't work. I would appreciate any help. https://github.com/dzgierski19/pizzeria-project
My JS code :
`const templates = {
menuProduct: Handlebars.compile(document.querySelector(select.templateOf.menuProduct).innerHTML),
};`
My HTML
`<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.1.0/handlebars.min.js"></script>
`
handlebars error
Have you tried to change the handlebars version?
You're using version 4.1.0, but handlebars it's already on version 4.7.7
Theirs any reason to use such an old version?
If you need to use this version, take a look at this version docs to check if it's available and if the methods you're using are right.
At the official doc the say to use #latest version
https://handlebarsjs.com/guide/#installation

Lazyload polyfill / Magneto 2 js error "loading-attribute-polyfill.js Uncaught ReferenceError: module is not defined"

I am trying to load this lazyload polyfill script into my Magneto 2 project.
The code works but there is a console error I am trying to fix and having no luck.
Chrome console:
loading-attribute-polyfill.js Uncaught ReferenceError: module is not defined
at loading-attribute-polyfill.js:263
Safari console:
ReferenceError: Can't find variable: module
I have tried loading it in the head via xml, manually before end in a phtml template, and also through requirejs-config.js, all give the same error.
In case it matters I was loading it via requirejs like this:
var config = {
deps: [
"js/vendor/loading-attribute-polyfill"
],
map: { ... }
};
Has anyone implemented this script into magento 2 without this error? Is there a manual edit I can make to the script to workaround this?
Cheers!!
Which version of this polyfil are you trying to use? There are many versions https://github.com/mfranzke/loading-attribute-polyfill/tree/master/dist
The UMD one looks to be RequireJS compatible, but will probably need changes in the config.
#DamianDziaduch after replying to your comment I tried using the UMD version again via requireconfig.js 'deps' and it does work, console error gone, must have been caching or something when I tried before 🤷‍♀️ thanks for the tip!
Now I know to use UMD javascript where possible in magento2/requirejs (I did not come across this info when Googling!) 👍😎👍

Error in console: ng.probe is not a function

Yesterday I updated Angular CLI and core to 8.0.0v. After that I successfully initialized a new app and ran it. Once the app was built and served on localhost:4200 I opened the console and there was an error:
ng.probe is not a function
I tried to research the issue, but there was no relevant info about it.
Actual result:
After ng serve / npm start there is an issue in the console:
Uncaught TypeError: ng.probe is not a function. Current console
state
Current angular
state
Expected result:
No error in the console
If someone is looking for an alternative to:
ng.probe($0)
In Ivy, then please try this:
ng.getComponent($0);
Found it here, https://juristr.com/blog/2019/09/debugging-angular-ivy-console/
Thought I'd add this here for completion.
Note about ng.getComponent: you must focus the component tag ( e.g. <app-my-component> ) in the developer tools elements so that it will be in $0. It doesn't search up the hierarchy for parent components ( like ng.probe does ).
If you're using Augury extension, disable or remove it. then, check the console. I've had the same issue and I removed the Augury.
Augury is having different set of debugging APIs, that's why that error occur.
Yes, augury assumes angular dev mode is active if window.ng exists, but ivy doesn't export probe right now
I have augury but after I disable the extension there is no error anymore.
You could also run without Ivy with this in your tsconfig.app.json
"angularCompilerOptions": { "enableIvy": false }
This is not exactly related to this question, but googling led me here. So, I am leaving the solution to my problem here in hopes that it will help others who face the same problem.
I was getting ng.probe not a function error when I created a angular project using dotnet sdk(version 5.0.300) and ran it locally. The project was using #angular/core v8.2.12, and #angular/cli v8.3.29.
I was able to solve the problem by update these packages using -
ng update #angular/core#8 #angular/cli#8
or
npm run ng update #angular/core#8 #angular/cli#8

Error in Angularjs while updating from 1.2.27 to 1.4.7

I am working on a app which was using 1.2.27 version of Angularjs so I decided to update it to 1.4.7 version of Angularjs. but after doing that I am getting error in Angularjs file.
SyntaxError: Unexpected token : (angular.js:12477)
at Function (native)
at Object.sd.compile (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:212:409)
at fc.parse (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:238:193)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:117:315
at n.$watch (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:127:125)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:281:486
at aa (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:73:90)
at K (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:62:39)
at g (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:54:410)
at K (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:61:488)
In console error chrome is not showing any app javascript error. Can any suggest me how to debug this error.
There are some syntax differences between the legacy and newer versions of angular.
See this guide for how to migrate between angular versions.

Categories

Resources