How can I use cshtml files with Durandal?

后端 未结 8 2280
你的背包
你的背包 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:20

    Following link shows how to customize moduleid to viewid mapping

    http://durandaljs.com/documentation/View-Location/

    by convention durandal tries to find view url in following steps

    1) Checke whether object has getView() function which returns either dom or a string ( url for the view)

    2) If object does not have getView function then checks whether object has viewUrl property

    3) If above two steps fails to produce url or a DOM view drundal falls to default convention

    which maps moduleid xyz.js to view xyz.html using view url ( path of Views folder ) defined in main.js

    so for moduleid xyz.js path of the view will be views/xyz.html

    you can overwrite this default mapping behavior by overwriting convertModuleIdToViewId function.

    So there are many ways you can customize your view url for specific model (.js object)

提交回复
热议问题