-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAngularApp.cshtml
34 lines (29 loc) · 1.14 KB
/
AngularApp.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@inherits Custom.Hybrid.RazorTyped
@using ToSic.Razor.Blade;
@using ToSic.Sxc.Services;
@{
// Enable 2sic JS APIs (this will load the latest js-api to help with getting data from 2sxc data base)
var page = GetService<IPageService>();
page.Activate("2sxc.JsCore");
// Add <base> tag using RazorBlade - Angular needs this so that links changing dialogs (routes) work properly
HtmlPage.AddBase((Link.Base()));
// Create helper to manage the editions (live, staging etc.)
var editions = GetCode("shared/Editions.cs");
// Create helper to integrate angular best-practice
var ngHelpers = GetCode("shared/Angular.cs");
// Show the Angular either from ng-server (local) or from the compiled live/staging folders
if (editions.CurrentEdition == "local")
{
@Html.Partial("AngularApp.PartLocalAssets.cshtml")
}
else
{
@Html.Raw(ngHelpers.ImportAngularHtml(editions.CurrentEdition))
;
}
// Show edition selector for host/super users only - you could also change this, to allow testers to see this *@
if (MyUser.IsContentAdmin)
{
@Html.Partial("AngularApp.PartEditions.cshtml", new { Editions = "live,staging,local" })
}
}