I am trying to experiment with ASP MVC 5 and Emberjs. I dont want to create full-fledge WebAPI that emberjs will serve. What I want is to mix both and use emberjs for data driven pages and razor view for simple pages.
So far I just tried ember-cli because I dont know how to build the emberjs app when combined with asp mvc.
My question is how to automatically import and compile the templates and js related to emberjs to be used on my asp mvc razor views?
Also I've read about es6 module in ember-cli, I dont know if its necessary to solve my problem.
You'll likely want to use ember-cli to first build your Ember application using ember build
(reference). Then ensure the output of build
command (likely in the /dist
folder unless you specified a different output path) is in a place that your Asp.Net MVC application has visibility of.
You can serve your newly built assets from your MVC application like this:
return File(Server.MapPath("~/my-ember-app/dist/") + "index.html", "text/html");
If your Ember application is located in the same folder as your Asp.Net MVC application each time you run ember build
the new output should be sent to browser when the associate MVC route returns index.html
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With