灰烬CLI和ASP.NET [英] Ember CLI and ASP.NET

查看:149
本文介绍了灰烬CLI和ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地使用了EmberJS JavaScript框架与ASP.NET Web应用程序,通过引用ember.js文件。

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

我是IM pression的灰烬-CLI 是灰烬将在以后的版本中标题的方式下。

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

如果这是正确的,什么是适当的方式继续使用灰烬前进?是否有意义使用灰烬-CLI与ASP.NET,或者是假设客户永远都只有静态的HTML和CSS / JS调用返回到服务器端code(如的WebAPI)?

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)?

推荐答案

Ember公司-CLI仅仅是命令行工具链的灰烬社区福字,所以它的真正建立烬应用程序只是一种不同的方式。

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.

我实际使用灰烬-CLI与ASP.NET MVC和的WebAPI。基本上我在做什么用EmberCLI输出一个index.html文件(烬新的myapp <​​/ code>设置了一个项目在默认情况下做到这一点),然后有我的MVC应用程序到/应用的网址,其中控制器返回查看路线(〜/ whateverdirectory / MyApp的/距离/ index.html的); 剃刀不关心视图返回是不是.cshtml文件,所以这个工作得很好,特别是如果你使用灰烬来控制整个页面。这样,您就可以使用ASP.NET标准的认证,然后当用户登录时,将其发送到通过MVC在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.

更新2015年8月18日

我已经添加在GitHub上一些样本code。

I've added some sample code on github.

这篇关于灰烬CLI和ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆