Skip to content

Instantly share code, notes, and snippets.

View cnurse's full-sized avatar

Charles Nurse cnurse

View GitHub Profile
<h3>Data coming from server values API</h3>
<ul>
<li *ngFor="let value of values">
{{ value }}
</li>
</ul>
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
app.UseStaticFiles();
app.UseSpaStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(name: "default", template: "{controller}/{action=index}/{id}");
});
app.UseSpa(spa =>
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddSpaStaticFiles(c =>
{
c.RootPath = "ClientApp/dist";
});
}
IList<string> templates = new List<string>();
var blog = GetBlogs().SingleOrDefault(b => b.Id == blogId);
if (blog != null)
{
foreach (var fileProvider in _viewEngineOptions.FileProviders)
{
var files = fileProvider.GetDirectoryContents($"/Views/Themes/{blog.Theme}/Templates");
@using Naif.Blog.ViewModels;
@model BlogViewModel
@{
if(!string.IsNullOrEmpty(Model.Page.PageTemplate))
{
Layout = $"~/Views/Themes/{Model.Blog.Theme}/Templates/{Model.Page.PageTemplate}.cshtml";
}
}
@{
Layout = "_Layout";
}
@{
var user = new UserProfile
{
Name = User.Identity.Name,
EmailAddress = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Email)?.Value,
ProfileImage = User.Claims.FirstOrDefault(c => c.Type == "picture")?.Value
};
}
<section>
public override void Process(TagHelperContext context, TagHelperOutput output)
{
string content = @"<div class='col-md-2'>";
if (string.IsNullOrEmpty(Image))
{
content += $@"<img src='{Image}' alt='' class='img-rounded img-responsive' />";
}
content += @"</div>";