1

I am just missing the boat on this error. Even the most simplistic of implementation of a custom directive throws precompiler errors and on execution throws the same errors.

Since this could be a version issue here is what I think relevant but if not just tell me and I'll add info.

Angular 1.4.8

angular.min.js
angular-route.min.js

VS 2015 & .Net 4.5

app-MainNav.js

1.    (function ()
2.    {
3.  "use-strict";
4.
5.  angular.module("app-MainNav", [])
6.      .directive("Dashboard-Main-Nav", function ()
7.      {
8.          return
9.          {
10.             restrict:"E",
11.             templateUrl:"/Navigation/GetDashItems",
12.             link:function(){}
13.         }
14.     });
15.    })();

At the colon of line 11 & 12 I get expected ; errors.
At line 12 I get expected identifier function()
Line 10 never has any issues no matter the order.

If I remove the comma on line 10 & 11 the expected ; error goes away...but this flies in the face of every tutorial I have seen on custom Angular directives.

Further no matter what I've tried the unexpected identifier does not go away.

halfer
  • 19,824
  • 17
  • 99
  • 186
GPGVM
  • 5,515
  • 10
  • 56
  • 97

1 Answers1

3

return statement terminates with newline, use:

return {
  ...
}

see What are the rules for Javascript's automatic semicolon insertion (ASI)?

Community
  • 1
  • 1
Aprillion
  • 21,510
  • 5
  • 55
  • 89