Umbraco 7.2.1 , ChildActionOnly .
[ChildActionOnly]
public ActionResult InitializeDataJson(KBMasterModel model)
{
var pluginUrl = string.Concat("/App_Plugins/", KBApplicationCore.PackageManifest.FolderName);
bool isAuthenticated = Request.IsAuthenticated;
IMember member = null;
if (isAuthenticated)
member = UmbracoContext.Application.Services.MemberService.GetByUsername(User.Identity.Name);
var data = new { CurrentNode = model.IContent, IsAuthenticated = isAuthenticated, LogedOnMember = member, PluginUrl = pluginUrl };
var json = JsonConvert.SerializeObject(data, Formatting.None, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore });
var kbData = new TLCKBData() { InitializationJson = json };
return PartialView(kbData);
}
:
@model TLCKBData
<script>
(function () {
var data = JSON.parse('@Html.Raw(Model.InitializationJson)');
tlckb.init(data);
})();
</script>
, :
@section FooterScript {
@{Html.RenderAction("InitializeDataJson", "KBPartialSurface", new { model = Model });}
}
. , , , , , UmbracoTemplatePage ( Umbraco), , RenderModel UmbracoTemplatePage.
.
, , , . GetContent .
, , - , API angular. , , .. , .. ..
, , . , "", ? , , .