<!DOCTYPE html>
<html>
<head>
<base href="." />
<script type="text/javascript" charset="utf-8">
window.AngularVersionForThisPlunker = 'latest'
</script>
<title>angular playground</title>
<link rel="stylesheet" href="style.css" />
<script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js/dist/zone.js"></script>
<script src="https://unpkg.com/zone.js/dist/long-stack-trace-zone.js"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.3/Reflect.js"></script>
<script src="https://unpkg.com/systemjs@0.19.31/dist/system.js"></script>
<script src="config.js"></script>
<script>
System.import('app')
.catch(console.error.bind(console));
</script>
</head>
<body>
<my-app>
loading...
</my-app>
</body>
</html>
/* Styles go here */
.accent-box {
position: relative;
padding-bottom: 10px;
margin-bottom: 10px;
}
.accent-box:after {
content: '';
position: absolute;
width: 25px;
height: 1px;
background: #607d8b;
border: 1px solid #607d8b;
bottom: 0;
left: 50%;
margin-left: -12.5px;
}
.accent {
color: #ffa000;
font-weight: 500;
font-size: 25px;
margin: 0;
}
.slide-img {
width: 33%;
max-width: 250px;
}
.margin-bottom {
margin-bottom: 50px;
}
.text-center {
text-align: center;
}
.full-width {
display: block;
width: 100%;
}
/*
w3 styles adapted from https://www.w3schools.com/w3css/4/w3.css
*/
.w3-display-container {
position: relative;
}
.slides {
color: #607d8b;
}
.w3-button {
display: none;
}
.w3-content {
max-width: 980px;
margin: auto;
}
.slides {
transition: opacity 500ms linear, visibility 0s linear;
visibility: visible;
opacity: 1;
position: relative;
min-height: 350px;
}
.hide-slide {
visibility: hidden;
position: absolute;
top: -100vw;
left: -100vw;
opacity: 0;
}
.w3-display-left {
position: absolute;
top: 40%;
left: 0%;
transform: translate(0%,-50%);
-ms-transform: translate(-0%,-50%);
}
.w3-display-right {
position: absolute;
top: 40%;
right: 0%;
transform: translate(0%,-50%);
-ms-transform: translate(0%,-50%);
}
.w3-button {
color: #607d8b;
background-color: #ccc;
transition: all .2s ease-out;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: none;
display: inline-block;
outline: 0;
padding: 8px 16px;
vertical-align: middle;
overflow: hidden;
text-decoration: none;
text-align: center;
cursor: pointer;
white-space: nowrap;
}
### Angular Starter Plunker - Typescript
var angularVersion;
if(window.AngularVersionForThisPlunker === 'latest'){
angularVersion = ''; //picks up latest
}
else {
angularVersion = '@' + window.AngularVersionForThisPlunker;
}
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
paths: {
'npm:': 'https://unpkg.com/'
},
//map tells the System loader where to look for things
map: {
'app': './src',
'@angular/core': 'npm:@angular/core'+ angularVersion + '/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common' + angularVersion + '/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler' + angularVersion + '/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser' + angularVersion + '/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic' + angularVersion + '/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http' + angularVersion + '/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router' + angularVersion +'/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms' + angularVersion + '/bundles/forms.umd.js',
'@angular/animations': 'npm:@angular/animations' + angularVersion + '/bundles/animations.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser' + angularVersion + '/bundles/platform-browser-animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations' + angularVersion + '/bundles/animations-browser.umd.js',
'@angular/core/testing': 'npm:@angular/core' + angularVersion + '/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/common' + angularVersion + '/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/compiler' + angularVersion + '/bundles/compiler-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/platform-browser' + angularVersion + '/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic' + angularVersion + '/bundles/platform-browser-dynamic-testing.umd.js',
'@angular/http/testing': 'npm:@angular/http' + angularVersion + '/bundles/http-testing.umd.js',
'@angular/router/testing': 'npm:@angular/router' + angularVersion + '/bundles/router-testing.umd.js',
'tslib': 'npm:tslib@1.6.1',
'rxjs': 'npm:rxjs',
'typescript': 'npm:typescript@2.2.1/lib/typescript.js'
},
//packages defines our app package
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
},
rxjs: {
defaultExtension: 'js'
}
}
});
//main entry point
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app';
platformBrowserDynamic().bootstrapModule(AppModule)
//our root app component
import {Component, NgModule, VERSION} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
import {SlideshowComponent} from './slideshow.component'
import {SlideComponent} from './slide.component'
@Component({
selector: 'my-app',
template: `
<div>
<app-slideshow></app-slideshow>
</div>
`,
})
export class App {
name:string;
constructor() {
this.name = `Angular! v${VERSION.full}`
}
}
@NgModule({
imports: [ BrowserModule ],
declarations: [ App, SlideshowComponent, SlideComponent ],
bootstrap: [ App ]
})
export class AppModule {}
import { Component, OnInit } from '@angular/core';
import {Slide} from './slide';
@Component({
selector: 'app-slideshow',
template: `
<div class="w3-content w3-display-container">
<div *ngFor="let slide of slides" [class.hide-slide]="!slide.selected" class="text-center slides margin-bottom">
<app-slide
[imageUrl]="slide.url"
[slideTitle]="slide.title"
[bodyText]="slide.body"
></app-slide>
</div>
<button class="w3-button w3-black w3-display-left" (click)="slide(-1)">❮</button>
<button class="w3-button w3-black w3-display-right" (click)="slide(1)">❯</button>
</div>
`,
})
export class SlideshowComponent implements OnInit {
public slideIndex: number;
public slides: Slide[];
constructor() { }
ngOnInit() {
this.slideIndex = 1;
this.slides = [
{
url: 'https://firebasestorage.googleapis.com/v0/b/prod-storagepug-landing-page.appspot.com/o/blue%20icons%2Fcustomer-service-blue.png?alt=media&token=4d9517ca-b9d3-4c56-b54c-f89dd8635f37',
title: 'Customer Portal',
body: 'StoragePug is a suite of software tools and services to help storage facilities get more customers and serve them better.',
selected: false
},
{
url: 'https://firebasestorage.googleapis.com/v0/b/prod-storagepug-landing-page.appspot.com/o/blue%20icons%2Frent-online-blue.png?alt=media&token=bcffb620-b330-4291-b1f4-f828bb39a632',
title: 'Marketing Website',
body: 'We build custom websites, mobile apps, and customer portals that update inventory, lease units, and manage payments in real-time.',
selected: true
},
{
url: 'https://firebasestorage.googleapis.com/v0/b/prod-storagepug-landing-page.appspot.com/o/blue%20icons%2Funlock-gate-blue.png?alt=media&token=ba3ecf78-f6d5-4e54-ba5b-b2aeec8efd69',
title: 'Mobile App',
body: 'These tools level the playing field between you and the big storage chains by providing the customer service technology you need at a fraction of the traditional price.',
selected: false
}
];
}
slide(indexDirection: number): void {
this.slides[this.slideIndex].selected = false;
this.slideIndex += indexDirection;
if(this.slideIndex < 0)
this.slideIndex = this.slides.length - 1;
this.slideIndex = this.slideIndex % this.slides.length;
this.slides[this.slideIndex].selected = true;
}
}
import {Component, Input} from '@angular/core';
@Component({
selector: 'app-slide',
template: `
<div class="full-width text-center">
<img class="slide-img" [src]="imageUrl">
</div>
<div class="accent-box">
<h3 class="accent">{{slideTitle}}</h3>
</div>
<p>{{bodyText}}</p>
`,
})
export class SlideComponent {
@Input('imageUrl') imageUrl: string;
@Input('slideTitle') slideTitle: string;
@Input('bodyText') bodyText: string;
constructor() { }
}
export class Slide {
constructor(
public url: string,
public title: string,
public body: string,
public selected: boolean
) {}
}