Angularjs application crash 'Error: [injector:modulerr]' - javascript

I am new to Angular.JS, trying to learn debugging errors.
My application have 5 pages all are working fine except one page, while loading I am getting this error
Error:[$injector:modulerr] http://errors.angularjs.org/1.2.28/$injector/modulerr?p0=newIntake...
I am getting one more error:
TypeError: Accessing the 'arguments' property of a function is not allowed in strict mode\n at Anonymous function.
while researching I learnt this error appear if any file is missing, i check all file loading in this particular page are available.
I really appreciate if someone provide me any hint or point me where to see exact error which could solve this issue.
Please let me know if more information is needed.

The error because you are accessing arguments property of a function that is not allowed in strict mode. You have two options. First one, remove use strict, may be in the top two lines of your code. Or you can go to second option that is access the arguments with a variable instead of accessing them directly. For example, you are calling somewhere like,
ABC('hi'); and
Accessing like
function ABC(name){
console.log(arguments); // remove this as it is not allowed in strict mode
console.log(name); // use this
}

Related

TypeError: Cannot read property "range" from undefined. (line 2, file "Server")

I have a sheet with a load of peoples player IDs that then whitelists people on the server, however im having the problem of when I attempt to run the script (this has worked seemlessly for over a year on my other database (i just made a copy of that database hoping the scripts would still work but they dont)
TypeError: Cannot read property "range" from undefined. (line 2, file "Server")
On line 2 for some reason
CODE:
http://pastebin.com/DMTBA1Sv
EXAMPLE DATA:
I'm not very good with the technical aspect however I do project management and have worked with these scripts for a while but arent working on my copy of database.
Something about the way you are triggering the function has most likely changed. You are passing a parameter 'e' into the function processServerWL when you define the function, but when the function actually runs, there in no 'e' (short for event passed in).
The error is saying that it can read the property range because 'e' has not be defined. This is a pretty common error when triggers aren't set right, so make sure that is the case. Without understanding more about your use context, there isn't any way to tell why the event (e) parameter isn't being passed. My bet, there is a trigger that needs to be set.
Here is a link to a more detailed blog post on this error and some ways to fix it: http://www.jeffreyeverhart.com/2016/08/06/fix-typeerror-cannot-read-property-values-undefined/

Looping through array of functions - Object doesn't support this property or method (IE8)

I'm trying to loop through array of functions and execute all of them.
Here's my code-
for(var x=0;x<myFunctions.length;x++) {
myFunctions[x]();
}
it works without any error/warning on other browsers but IE(8) throws this warning:
Object doesn't support this property or method
The function does execute and everything goes fine.
Can someone explain what might be causing this error?
note: the error persist regardless of what's in the function that's being executed, i tried running a blank function even
It would be great if you could share a function example.
You might get an error within the function itself, use the debug tool (at the browser usually f12) an go line by line.
BTW Read about 'call' and 'apply' as to how to execute javascript functions.

How to access controls from a console

I tried to execute the following command from the console.
var subject = Xrm.Page.ui.controls.get("subject");
That's the exact syntax I'm using in the web resource that I'm plugging in to CRM. However, I only got an error message saying that "unable to get property 'controls' of undefined or null reference".
I do understand the message. What I want to know is two-fold.
What syntax will work from the console (F12) to refer to the stuff on the screen?
Why doesn't it work the way I did? Where doesn ui come from?
I've checked that I can refer to both Xrm and Crm.Page but apparently ui is null (it's listed when I print out the contents of Page but sett to null).
I know this is a kinda old thread, but if you still getting that 'object doesn't support property..' error when executing the command from console, IE F12; try calling it from the frame i.e
frames[0].Xrm.Page.getAttribute("controlId").getValue();
In CRM 2013 it is a little different
frames[1].Xrm.Page
It's kind of tough to detect the frames across different browsers, so this little javascript can help you out:
for(var i=0;i<5;i++) //loop through 0 to 4
if(frames[i].Xrm.Page.ui != undefined) //check if undefined
{
Xrm = frames[i].Xrm; //assign Xrm
console.info("~: Xrm updated with frame " + i + " :~"); //show info
break; //breakout the loop
}
What it does ?
What it's basically doing is to loop through 0-5 to find frame where
Xrm.Page.ui is not undefined, once it gets it it assigns it to the Xrm and breaks the loop.
How to use ?
To use it just copy/paste and run in the browser console once per
session then after you can run/test all your Xrm codes form the browser console.
This works for me Xrm.Page.getControl("controlId"). It's just a shortcut for what you have already though...cant-disable-set-to-read-only-protect-gray-out-etc-a-field
In addition to what #Daryl said, I can add that I use different syntax. For some reason, I don't get his to work either. Might have to do with different browser version or something. Instead try to execute this, if you still can't get it to work (although I must admit that his is shorter = better).
Xrm.Page.getAttribute("lastname").getValue();
The lastname parts is tested a minute ago on creation of an instance of entity Contact. I just put in a breakpoint inside a script that is executed onchange and while broken-pointed, I entered the command above to the console.
If neither approach works for you, you've got some weird problem with your CRM or browser.
A reason some people need this information is to access their own code. If you need to access your own methods from the console, in 2011, any global methods (or namespaces) in your javascript were also in forms[0]. Obviously, this is a bad idea, just from a naming standpoint. In forms v6+ any global objects or functions are in an object called customScriptsFrame inside frames[0] (or presumably whichever frame the Xrm is found).
frames[0].customScriptsFrame.myFunctionName();

"Object doesn't support property or method 'getAttribute'"

I'm working with Dynamics CRM 2011 Online and trying to refactor some code that works on the Quote > Add Product page to also work on Order > Add Product. The problem is that when the page loads I get the error "Unable to get property 'getValue' of undefined or null reference."
I went into the IE console (tried both IE 9 and 10) and typed in what I believed to be the offending line:
Xrm.Page.getAttribute('ati_clin').getValue()
It complains with "Object doesn't support property or method 'getAttribute'". I also tried
document.getElementById('ati_clin')
but that too fails.
This doesn't make sense to me because I can use the HTML view of the developer console to find the object on the page and it's clearly there (no typo too). It also doesn't make sense that this statement fails in the console on both pages even though one of the pages runs properly at runtime and the other doesn't. Shouldn't it at least work on the page that does work at runtime?
After doing some research I think the following posting is the most relevant but I'm afraid it doesn't lead me to an answer seeing as how new I am to this: Xrm.Page.data is null
My question is why does the console return this error if the element clearly exists?
A handy trick when debugging a problem like this:
The Xrm.Page object lives in the context of a frame. If you want to use console in IE Developer tools without having to break in debug mode, you first have to point to the frame on the page.
Example:
frames[0].Xrm.Page.getAttribute('ati_clin').getValue()

How do I use firebug to debug an app that uses jQuery, when the reported error is in jquery (the data passed to jquery)

Often the error in the console does not include a trace or error object, but just a simple message like :
object is undefined
length = object.length,
so I can't easily find the part of the app that is calling jquery with the faulty data.
At present I am tracking them down by entering a long trail of logs until I find the broken code. This is time consuming and is becoming more so as the app grows in complexity. Is there an easier way?
Edit: to add screenshot
In the console where you see the error:
click the circled part so that it becomes fully red:
then refresh the page. Firebug will break at the error, interrupting the execution of the script at that precise point.
You can now examine the stack trace (which includes the call stack), and use "Watch" to watch the value of variables.
in firebug you can write conlose.log(object name) then open the console you will get complete object.
Use debugger (inside the function calls where u expect to receive values from controller)inside the script.

Categories

Resources