Imtiaz Rifat
Imtiaz Rifat

Reputation: 41

How to load HTML page in MVC 5 for Angularjs routing?

I want to use the SPA concept of angularjs in MVC 5, but cant handle the routing. I want my main page to view in Razor and load portion of the page using angularjs. I know my description is not sufficient but hope anyone will help me through. Thanks in advance.

Upvotes: 0

Views: 522

Answers (2)

Chandermani
Chandermani

Reputation: 42669

Look at the project template AngularStart

https://visualstudiogallery.msdn.microsoft.com/cc6c9c5f-2846-4822-899f-a6c295cd4f2b

I am author of this template and it shows how can client side routing and mvc routing can be combined. This has been created for MVC 4, but you will get an idea.

I also created a blog post http://blog.technovert.com/2013/12/setting-up-angularjs-for-asp-net-mvc-n-webapi-project/ explaining the approach.

Upvotes: 2

Simon
Simon

Reputation: 86

You may run into conflict if routing is setup both for MVC 5 and Angular. For SPA portion use only Angular routing. That being said you can still have a hybrid solution for partials where angular templates are assembled by Razor templates (which is a very powerful feature).

Upvotes: 0

Related Questions