Is this possible to implement asp.net web api (.net framework) in angular 4?
I've followed the docs in angular.io and I've already implemented it in my machine, and it has AOT.
By the way I am using Visual Studio Enterprise 2015.
My question is how to config the startup.cs .(net framework asp.net web api) into my angular 4.
What i always saw was implement angular 4 in asp.net core.
So I can't display the data from web api to my angular 4 project.
I am not angular expert but i can provide you few helpful links, after understanding your requirements
1.How to display my angular 4 project(Index.html) in _Layout.cshtml with AOT
-> Take a look at this Url you will find complete guide to set up project(although it is angular 2, but angular 2 and 4 are almost same)
https://www.codeproject.com/Articles/1181888/Angular-in-ASP-NET-MVC-Web-API-Part
2.What is the configuration to consume my angular 4 project the web api i created, dynamically.
-> You may have to configur your project's Route, as you posted above your Projects are in same solution, you need proper routing all the details are in above link, which step by step guide, i believe you need to configure route using code below for your mvc web api project
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute(
name: "Default",
url: "{*anything}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
Other helpful links, which can help you
http://www.codemag.com/article/1705091
https://www.codeproject.com/Tips/1136450/Consume-WEBAPI-in-Angularjs
http://www.dotnetcurry.com/aspnet/1049/crud-database-aspnet-webapi-angularjs
Hope this helps, if you will look carefully on First link and Second link of this comment you will get your answers for sure
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly