… if we have access to the network • HTML, scripts and styles have to be downloaded • Unless we are using Application Cache that is deprecated • Service Workers whose specification isn’t finished yet • The views are rendered on the server, in general ASP.NET applications are usually not designed to run completely offline What about ASP.NET? 4
Business Logic Ressource / Data Access (EF) SQL Server MySQL Sqlite WS Files Angular + HTML + JS Browser Cordova iOS Android Electron Win MacOS Linux CefSharp .exe Win 8 & 10
in ASP.NET 11 [ViewComponent] public class CustomerFormViewComponent : ViewComponent { public IViewComponentResult Invoke() { var customer = new CustomerViewModel() { Name = "Customer name"}; return View(customer); } } @using (Html.BeginForm()) { @Html.Label("Name:"); @Html.TextBoxFor(model => model.Name); } @Component.Invoke(typeof(CustomerFormViewComponent))
Server-side rendering Angular 2 • HTML (Built-in Parser) • Client-side rendering by default • Open rendering architecture (can be done on server or in mobile native environments) Declarative View Definition 13
Razor markup is type safe as well Angular 2 • Uses TypeScript that is a typed superset of Javascript Type Safety 15 @Component({ … }) class CustomerForm { public name: string; constructor() { … } public submit(): void { … } }