Skip to content

Instantly share code, notes, and snippets.

View squadwuschel's full-sized avatar
💭
Working

SquadWuschel squadwuschel

💭
Working
  • Relaxdays
  • Germany
View GitHub Profile
@squadwuschel
squadwuschel / consoleInterceptor.ts
Created August 24, 2016 20:26
AngularJs HTTP Interceptor
module App.AppComponents.Interceptors {
consoleInterceptor.$inject = ["$injector", "$q"];
export function consoleInterceptor($injector: ng.auto.IInjectorService, $q: ng.IQService): any {
return {
// On request success
request: function(request) {
console.log("Request Success");
console.log(request);
@squadwuschel
squadwuschel / helloWorldJavaScript.jsx
Created August 27, 2016 21:04
JavaScript JSX Datei für Visual Studio 2015
var Hello = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
ReactDOM.render(
<Hello name="World" />,
document.getElementById('helloWorld')
@squadwuschel
squadwuschel / package.json
Created August 27, 2016 21:14
Package.json für einfaches Hello World mit React
{
"author": "SquadWuschel",
"description": "Packages für Hello World mit React",
"private": true,
"dependencies": {
"react": "15.3.1",
"react-dom": "15.3.1"
}
}
@squadwuschel
squadwuschel / bundles.cs
Last active August 27, 2016 21:33
Bundles für React und React-dom
//Bundles für die React Bibliothek und Jquery
bundles.Add(new ScriptBundle("~/bundles/libraries").Include(
"~/Scripts/jquery-{version}.js",
"~/node_modules/react/dist/react-with-addons.js",
"~/node_modules/react-dom/dist/react-dom.js"
));
//Bundle für unsere React Anwendung
bundles.Add(new ScriptBundle("~/bundles/app").Include(
"~/ScriptsApp/helloWorldTypeScript.js",
@squadwuschel
squadwuschel / Layout.cshtml
Created August 27, 2016 21:34
React Hello World Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Meine ASP.NET-Anwendung</title>
@Styles.Render("~/Content/css")
</head>
<body>
@squadwuschel
squadwuschel / helloworldTypeScript.tsx
Created August 27, 2016 21:54
TypeScript TSX Datei für Hello World React Beispiel
/// <reference path="../typings/tsd.d.ts" />
// A '.tsx' file enables JSX support in the TypeScript compiler,
// for more information see the following page on the TypeScript wiki:
// https://github.com/Microsoft/TypeScript/wiki/JSX
var Counter = React.createClass({
add: () => {
console.log('add 1!');
},
@squadwuschel
squadwuschel / ProxyController.cs
Created October 22, 2016 17:46
.NET Controller für Angular 2 Proxygenerierung
using ProxyGenerator.ProxyTypeAttributes;
public class ProxyController : Controller
{
[CreateAngular2TsProxy(ReturnType = typeof(Person))]
public JsonResult AddTsEntryOnly(Person person)
{
return Json(person, JsonRequestBehavior.AllowGet);
}
@squadwuschel
squadwuschel / proxyService.ts
Created October 22, 2016 17:50
Automatisch erstellter Service für Angular 2 aus .NET Controller
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/observable';
import 'rxjs/add/operator/map';
@Injectable()
export class Proxyservice {
constructor(private http: Http) { }
@squadwuschel
squadwuschel / app.component.ts
Last active October 31, 2016 12:18
Angular 2.1.1 app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: '<h1 class="well well-sm text-center">Hello World to - {{name}}</h1>'
})
export class AppComponent {
public name : string = "SquadWuschel";
constructor() {
}
@squadwuschel
squadwuschel / app.module.ts
Last active October 31, 2016 12:18
app.modules Definition von globalen Modulen für unsere Angular 2.1.1 App
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
imports: [BrowserModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }