How can I use cshtml files with Durandal?

后端 未结 8 2276
你的背包
你的背包 2020-12-01 01:50

I got the DurandalJS StarterKit template on VS2012... All works great...

But in some views I need to do something like that:

@if (Roles.IsUserInRole(         


        
8条回答
  •  日久生厌
    2020-12-01 02:10

    DurandaljS is a client framework which forms mainly a solid base for single-page apps (SPA). I assume you are using asp.net web API as your server technology. In that case, you can determine the user's role inside your API controller and based on that return data to the client. On the client you can use Knockout "if" binding in order to show / hide certain areas of your page.

    What you perhaps can do is placing this code in the Index.cshtml.

提交回复
热议问题