0

Until the end of my Angular application development period, I worked with two seperate projects. WebApi and Angular SPA.

Now I am trying to deploy them to our production server and because of the need for seperate SSL certificates, we decided to combine them and run in the same Project. So far so good...

I managed to combine them together and the server side code compiles. Now when I run the app, the first call to the API results in a parse error with the homepage contents (full of html). I understand that this is due to the $urlRouterProvider 's otherwise attribute, routing all the non-routed paths to the root "/".

I need to fix it, excluding the paths which includes /api in them in order to bypass Angular's routing system out of API's way. Any ideas to help?

EDIT: New project is a combination of WebApi (v2 - Asp.Net) and Client App (Angular v1.3.15 on MVC5 views. And yes, html5Mode(true) but doesn't change a thing if turned off).

EDIT2: Forgot to mention, the error is raised from a jQuery ajax call, outside the angular scope. :$

ilter
  • 4,030
  • 3
  • 34
  • 51
  • Before you'll get the answer, you can check this to get some hints... http://stackoverflow.com/a/27707238/1679310 or http://stackoverflow.com/a/27675441/1679310 – Radim Köhler Apr 25 '15 at 15:55
  • 1
    it does not effect $http.get('/api' calls – YOU Apr 25 '15 at 15:56
  • Thank you, @YOU. Forgot to write, The error is with a jquery ajax function, not $http. Just updating my question. – ilter Apr 25 '15 at 15:57
  • you have – YOU Apr 25 '15 at 15:59
  • No, I am getting a list of objects before the application starts. That ran without any problems all this time. Just started to bite me after the merge of two projects. – ilter Apr 25 '15 at 16:03
  • @RadimKöhler, I checked the links you sent. The second one is with full of information I totally agree. But they both don't answer my question :( – ilter Apr 25 '15 at 16:14

1 Answers1

1

As interesting it is, I realized some other abnormalities in the way WebApi worked. Did some research and found out that it's because of the latest EntityFramework (v6.1.3). During my merge, I updated EF from v6.1.1 so uninstalled and 6.1.3 and installed back 6.1.1 and the problem is solved! That is very odd. EF 6.1.3 should have been a solid release without any breaking changes. Very odd...

Thanks to all who commented and tried to help.

EDIT: After some time, what I realized is this. EF models should be in sync with the Database in order to make successful database calls from WebApi. When I make an ajax call and the db is not in sync with the models, the problems in the question occures. I hope that information helps someone.

ilter
  • 4,030
  • 3
  • 34
  • 51