Skip to content

Instantly share code, notes, and snippets.

View fredrik-lundin's full-sized avatar

Fredrik Lundin fredrik-lundin

  • Spotify
  • Sweden
View GitHub Profile
@fredrik-lundin
fredrik-lundin / web.config
Created March 28, 2017 16:51
web.config rewrite all requests to index.html
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="redirect all requests" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="index.html" appendQueryString="true" />
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-red',
template: `
<div class="wrapper"></div>
`,
styles: ['div.wrapper { width: 500px; height: 500px; background-color: red; }']
})
export class RedComponent {}
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-blue',
template: `
<div class="wrapper"></div>
`,
styles: ['div.wrapper { width: 500px; height: 500px; background-color: blue; }']
})
export class BlueComponent {}
import { RouterLink } from '@angular/router/router';
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<h1> Angular CI Example! </h1>
<nav>
<a routerLink="/red">RED</a>
<a routerLink="/blue">BLUE</a>
@fredrik-lundin
fredrik-lundin / .angular-cli.json
Created March 28, 2017 17:10
Angular CLI defaults
...
"defaults": {
"styleExt": "css",
"component": {
"inlineStyle": true,
"inlineTemplate": true,
"spec": false
}
}
...
"assets": [
"assets",
"favicon.ico",
"web.config"
],
...
@fredrik-lundin
fredrik-lundin / package.json
Created March 28, 2017 17:24
Angular prod build script
...
"scripts": {
...
"build-prod": "ng build --prod --aot",
...
},
...
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { BlueComponent } from 'app/blue/blue.component';
import { RedComponent } from 'app/red/red.component';
const routes: Routes = [
{
path: '',
children: [
{
import {Component, NgModule, ContentChild,
Directive, Input, HostListener
ContentChildren, QueryList,
forwardRef, ElementRef
} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
@Component({
selector: 'my-app',
template: `
module.exports = function (config) {
config.set({
...
plugins: [
...
require('karma-coverage-istanbul-reporter'), // <- Add plugin
require('karma-junit-reporter'), // <- Add plugin
...
],
...