Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
256 views
in Technique[技术] by (71.8m points)

javascript - Ember CLI and ASP.NET

I've successfully used the EmberJS JavaScript framework with an ASP.NET web application, by referencing ember.js file.

I'm under the impression that Ember-CLI is the way Ember will be heading in future versions.

If this is correct, what's the appropriate way to keep using Ember going forward? Does it make sense to use Ember-CLI with ASP.NET, or is the assumption that the client is only ever static HTML and CSS/JS that calls back to server-side code (eg. WebAPI)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Ember-Cli is just the command line toolchain that the Ember community is "blessing", so it's really just a different way of building the ember app.

I'm actually using Ember-Cli with ASP.NET MVC and WebApi. Essentially what I'm doing is using EmberCLI to output an index.html file (ember new myapp sets up a project to do this by default), and then having my MVC app route to an /App url, where the controller returns a View("~/whateverdirectory/myapp/dist/index.html"); Razor doesn't care that the view you return isn't a .cshtml file, so this works fine, particularly if you're using Ember to control the whole page. This way you can use the standard authentication in ASP.NET, and then when the user is logged in, send them to the App controller's index route through MVC, and serve them the Ember app.

Update 8/18/2015

I've added some sample code on github.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...