× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Provider 'xx' must return a value from $get factory method in AngularJs

Naeem
Feb 26, 2015
<p>This is called <strong>Automatic semicolon insertion</strong></p> <p>The return statement is affected by automatic semicolon insertion (ASI). There is no line terminator <code>;</code> between the return keyword and the expression allowed.</p> <pre><code>return a + b; // is transformed by ASI into return; a + b; </code></pre> <p>So you must insert <code>{</code> in front of return and <strong>Not at the next line.</strong> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return</a></p> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/27738903/Provider%20'xx'%20must%20return%20a%20value%20from%20%24get%20factory%20method%20in%20AngularJs/27738985">Stack Overflow</a>.</p>

Get New Tutorials Delivered to Your Inbox

New tutorials will be sent to your Inbox once a week.

comments powered by Disqus