Angular syntax not working after upgrading to Angular 1.3.20 - angularjs

Recently we have updated our application to angular 1.3.20 version. But after the upgradation the existing code is throwing angular error.
app.controller('searchController', ['$scope','TemplateViewService','$http','SearchService','$browser','$rootScope','$state','$location', '$uibModal','ReadConfigurationService','$filter','SpinnerService','$log', function($scope,TemplateViewService,$http,SearchService,$browser,$rootScope,$state,$location, $uibModal,ReadConfigurationService,$filter,SpinnerService,$log){//PA1501-1206
var productType = undefined;
//PA1501-2173 start
$scope.dataList = SearchService.getDataList();
$scope.dataListCopy = SearchService.getDataListCopy();
$scope.deleteList = [];
$scope.displayArtifactList=[];
};
Here at this line I am getting Angular Js error Unknown provider TemplateViewService <- searchController.
Can anyone please suggest, how to resolve this error.

This is happening because of TemplateViewService js file is not getting compiler, please make sure it again....

Related

SCRIPT1002: Syntax error - IE 11 , on my Next js

So I migrated from CRA to Next Js. At first my app is working fine on IE 11 while I'm migrating from CRA to next js (I was testing it on IE every time I'm making changes). But then I forgot to test on IE, and now I fully migrated my app on nextjs, and I tried to open it on IE, now the page doesn't fully load because of this error, ( on both dev mode and prod mode). I notice that this error occurs when I'm trying to add my page and component that has socket io-client, I think the error is in debug/src/browser in node_modules. What I don't get is my CRA app also has this dependency, but why it works on IE while the Nextjs version doesn't? I used my old CRA app and just installed next, and made changes, so it has babel.
This is the error:
SCRIPT1002: Syntax error
_app.js (24050,23)
Now when I click it, this is the code where the error occurs
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = localstorage();
exports.destroy = (() => {
let warned = false;
return () => {
if (!warned) {
warned = true;
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
}
};
})();
Please help me! thank you.
I downgraded my socket.io-client version to socket.io-client#2.3.1

How get value of firebaseArray items

I try this code to log the information of each item in my firebaseArray :
$scope.events = $firebaseArray(ref.child('event').orderByChild('uid').equalTo(Auth.$getAuth().uid));
$scope.events.$loaded( function(snapshot){
console.log(snapshot.val());
})
I get this error: snapshot.val is not a function
Angular 1.2 seems to have this problem with firebaseArray. I also had the same problem and upgrading angular to 1.4.5 did the trick for me. you can also try: refered link.

ReferenceError: printStackTrace is not defined

I get the following error "ReferenceError: printStackTrace is not defined",
when I tried to use StackTrace in my angular aplication.
stacktrace.js changed the API for v1.0.
You'll want to use
var callback = function(frames) { console.log(frames); };
var errback = function(err) { console.log(err.message); };
StackTrace.get().then(callback).catch(errback);
as suggested by the docs.
If all you want to do is parse an Error you can just use error-stack-parser
Please refer to the v0.x -> v1.x migration guide if you were using the old version.
By the way, if you need to use version 0.x you can find it in the stable branch on GitHub

how do I use openPGP.js library with angularJS?

I'm pretty new to Angular. I'm trying to incorporate the openPGP library to my app (client side). I need some help on how to incorporate a javascript library to the Angular App. Thanks!
I'm reading through the openPGP docs https://github.com/openpgpjs/openpgpjs
and the example provide in the docs is below:
var openpgp = require('openpgp');
var key = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----';
var publicKey = openpgp.key.readArmored(key);
var pgpMessage = openpgp.encryptMessage(publicKey.keys, 'Hello, World!');
I prefer not to use require to source in openPGP to my app. So I've tried
var openpgp = window.openpgp; which seems to not throw any error here. However, I get TypeError: Cannot read property 'key' of undefined error.
I should mention that I have installed openpgp using bower install.
I'm still trying to figure out what I can do to refer to openPGP in the Angular app. Thanks.
If you're on the client-side, use a script tag, like
<script src="/path/to/openpgp.js"></script>
instead of require()

Adding new Module is not working in angularjs

i am trying to add a new Module to my application.
My HTML for index page is
<body ng-app="com.app">
In my app.js
angular.module('mod1', ['ngResource']);
angular.module('mod2', []); //this is module i want to add
var app = angular.module('com.app', ['ngResource','mod1','mod2']);
My Controllers1.js
var Controllers = angular.module('mod1');
Controllers.controller('ctrl1', function($scope,$http) {});
Controllers.controller('ctrl2', function($scope,$http) {}); //function for module 2
when i try to add this ctrl2 to my "controllers1.js" it works , but if i add this in my other js say "controllers2.js", its not working .
My controllers2.js is
'use strict';
var mymodule = angular.module('mod2');
mymodule.controller('ctrl2', function() {
console.debug("Testing...");
});
summary of my question is : when i try to add my ctrl2 function to new module, its not working and on firefox console i am getting error
Error: Argument 'ctrl2' is not a function, got undefined
assertArg#http://localhost:8080/tm-webapp/resources/lib/angular.js:1039
assertArgFn#http://localhost:8080/tm-webapp/resources/lib/angular.js:1050
#http://localhost:8080/tm-webapp/resources/lib/angular.js:4802
update#http://localhost:8080/tm-webapp/resources/lib/angular.js:14198
Scope.prototype.$broadcast#http://localhost:8080/tm-webapp/resources/lib/angular.js:8307
updateRoute/<#http://localhost:8080/tm-webapp/resources/lib/angular.js:7463
qFactory/defer/deferred.promise.then/wrappedCallback#http://localhost:8080/tm-webapp/resources/lib/angular.js:6846
qFactory/defer/deferred.promise.then/wrappedCallback#http://localhost:8080/tm-webapp/resources/lib/angular.js:6846
qFactory/ref/<.then/<#http://localhost:8080/tm-webapp/resources/lib/angular.js:6883
Scope.prototype.$eval#http://localhost:8080/tm-webapp/resources/lib/angular.js:8057
Scope.prototype.$digest#http://localhost:8080/tm-webapp/resources/lib/angular.js:7922
Scope.prototype.$apply#http://localhost:8080/tm-webapp/resources/lib/angular.js:8143
done#http://localhost:8080/tm-webapp/resources/lib/angular.js:9170
completeRequest#http://localhost:8080/tm-webapp/resources/lib/angular.js:9333
createHttpBackend/</xhr.onreadystatechange#http://localhost:8080/tm-webapp/resources/lib/angular.js:9304
I am stuck here for a long, kindly help me i shall be very thankful.
Regards,
Make sure that in your file loader (script tags, requirejs, whatever) Controllers1.js is right next to controllers2.js.
PS: some operating systems / webservers (e.g. the server inside karma on windows) are case sensitive. So try to use same case for your files (either upper or lower).
You can try this plunker http://plnkr.co/edit/tKIPDQ54JDexB7LAJpDR to see if it works in the way you want.

Resources