/** Add Transpiler for Typescript */
System.config({
transpiler: 'typescript',
typescriptOptions: {
emitDecoratorMetadata: true
},
packages: {
'.': {
defaultExtension: 'ts'
},
'vendor': {
defaultExtension: 'js'
}
}
});
System.config({
map: {
'main': 'main.js',
// Angular specific mappings.
'@angular/core': 'https://unpkg.com/@angular/core/bundles/core.umd.js',
'@angular/animations': 'https://unpkg.com/@angular/animations/bundles/animations.umd.js',
'@angular/common': 'https://unpkg.com/@angular/common/bundles/common.umd.js',
'@angular/compiler': 'https://unpkg.com/@angular/compiler/bundles/compiler.umd.js',
'@angular/http': 'https://unpkg.com/@angular/http/bundles/http.umd.js',
'@angular/forms': 'https://unpkg.com/@angular/forms/bundles/forms.umd.js',
'@angular/router': 'https://unpkg.com/@angular/router/bundles/router.umd.js',
'@angular/platform-browser': 'https://unpkg.com/@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'https://unpkg.com/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/animations/browser': 'https://unpkg.com/@angular/animations/bundles/animations-browser.umd.js',
'@angular/platform-browser/animations': 'https://unpkg.com/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/material': 'https://unpkg.com/@angular/material@2.0.0-beta.8/bundles/material.umd.js',
'@angular/cdk': 'https://unpkg.com/@angular/cdk@2.0.0-beta.8/bundles/cdk.umd.js',
// Rxjs mapping
'rxjs': 'https://unpkg.com/rxjs',
},
packages: {
// Thirdparty barrels.
'rxjs': { main: 'index' },
}
});
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {NgModule} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {
MdAutocompleteModule,
MdButtonModule,
MdButtonToggleModule,
MdCardModule,
MdCheckboxModule,
MdChipsModule,
MdCoreModule,
MdDatepickerModule,
MdDialogModule,
MdExpansionModule,
MdGridListModule,
MdIconModule,
MdInputModule,
MdListModule,
MdMenuModule,
MdNativeDateModule,
MdPaginatorModule,
MdProgressBarModule,
MdProgressSpinnerModule,
MdRadioModule,
MdRippleModule,
MdSelectModule,
MdSidenavModule,
MdSliderModule,
MdSlideToggleModule,
MdSnackBarModule,
MdSortModule,
MdTableModule,
MdTabsModule,
MdToolbarModule,
MdTooltipModule,
} from '@angular/material';
import {SliderConfigurableExample} from './slider-configurable-example';
import {HttpModule} from '@angular/http';
import {CdkTableModule} from '@angular/cdk';
@NgModule({
exports: [
CdkTableModule,
MdAutocompleteModule,
MdButtonModule,
MdButtonToggleModule,
MdCardModule,
MdCheckboxModule,
MdChipsModule,
MdCoreModule,
MdDatepickerModule,
MdDialogModule,
MdExpansionModule,
MdGridListModule,
MdIconModule,
MdInputModule,
MdListModule,
MdMenuModule,
MdNativeDateModule,
MdPaginatorModule,
MdProgressBarModule,
MdProgressSpinnerModule,
MdRadioModule,
MdRippleModule,
MdSelectModule,
MdSidenavModule,
MdSliderModule,
MdSlideToggleModule,
MdSnackBarModule,
MdSortModule,
MdTableModule,
MdTabsModule,
MdToolbarModule,
MdTooltipModule,
]
})
export class PlunkerMaterialModule {}
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
HttpModule,
PlunkerMaterialModule,
MdNativeDateModule,
ReactiveFormsModule,
],
declarations: [SliderConfigurableExample],
bootstrap: [SliderConfigurableExample],
providers: []
})
export class PlunkerAppModule {}
platformBrowserDynamic().bootstrapModule(PlunkerAppModule);
/** Copyright 2017 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license */
import {Component, ViewEncapsulation} from '@angular/core';
@Component({
selector: 'slider-configurable-example',
templateUrl: 'slider-configurable-example.html',
styleUrls: ['slider-configurable-example.css'],
encapsulation: ViewEncapsulation.None,
})
export class SliderConfigurableExample {
autoTicks = false;
disabled = false;
invert = false;
max = 100;
min = 0;
showTicks = false;
step = 1;
thumbLabel = false;
value = 0;
vertical = false;
get tickInterval(): number | 'auto' {
return this.showTicks ? (this.autoTicks ? 'auto' : this._tickInterval) : 0;
}
set tickInterval(v) {
this._tickInterval = Number(v);
}
private _tickInterval = 1;
add() {
this.value += 1;
}
onChange(event) {
this.value = event.value;
}
}
/** Copyright 2017 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license */
.example-h2 {
margin: 10px;
}
.example-section {
display: flex;
align-content: center;
align-items: center;
height: 60px;
}
.example-margin {
margin: 10px;
}
.mat-slider-horizontal {
width: 300px;
}
.mat-slider-vertical {
height: 300px;
}
<!DOCTYPE html>
<html>
<head>
<title>Angular Material Plunker</title>
<!-- Load common libraries -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/typescript/2.1.1/typescript.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.8.5/zone.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js"></script>
<!-- Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System
.import('main.ts')
.catch(console.error.bind(console));
</script>
<!-- Load the Angular Material stylesheet -->
<link href="https://unpkg.com/@angular/material@2.0.0-beta.8/prebuilt-themes/indigo-pink.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<style>body { font-family: Roboto, Arial, sans-serif; }</style>
</head>
<body>
<slider-configurable-example>Loading Material Docs example...</slider-configurable-example>
</body>
</html>
<!-- Copyright 2017 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license -->
<md-card>
<md-card-content>
<h2 class="example-h2">Slider configuration</h2>
<section class="example-section">
<md-input-container class="example-margin">
<input mdInput type="number" placeholder="Value" [(ngModel)]="value">
</md-input-container>
<md-input-container class="example-margin">
<input mdInput type="number" placeholder="Min value" [(ngModel)]="min">
</md-input-container>
<md-input-container class="example-margin">
<input mdInput type="number" placeholder="Max value" [(ngModel)]="max">
</md-input-container>
<md-input-container class="example-margin">
<input mdInput type="number" placeholder="Step size" [(ngModel)]="step">
</md-input-container>
</section>
<section class="example-section">
<md-checkbox class="example-margin" [(ngModel)]="showTicks">Show ticks</md-checkbox>
<md-checkbox class="example-margin" [(ngModel)]="autoTicks" *ngIf="showTicks">
Auto ticks
</md-checkbox>
<md-input-container class="example-margin" *ngIf="showTicks && !autoTicks">
<input mdInput type="number" placeholder="Tick interval" [(ngModel)]="tickInterval">
</md-input-container>
</section>
<section class="example-section">
<md-checkbox class="example-margin" [(ngModel)]="thumbLabel">Show thumb label</md-checkbox>
</section>
<section class="example-section">
<md-checkbox class="example-margin" [(ngModel)]="vertical">Vertical</md-checkbox>
<md-checkbox class="example-margin" [(ngModel)]="invert">Inverted</md-checkbox>
</section>
<section class="example-section">
<md-checkbox class="example-margin" [(ngModel)]="disabled">Disabled</md-checkbox>
</section>
</md-card-content>
</md-card>
<md-card class="result">
<md-card-content>
<h2 class="example-h2">Result</h2>
<md-slider
class="example-margin"
[disabled]="disabled"
[invert]="invert"
[max]="max"
[min]="min"
[step]="step"
[thumb-label]="thumbLabel"
[tick-interval]="tickInterval"
[value]="value"
[vertical]="vertical"
(input)="onChange($event)">
</md-slider>
<input [(ngModel)]="value" />
<button (click)="add()">+</button>
</md-card-content>
</md-card>
<!-- Copyright 2017 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license -->