<!DOCTYPE html>
<html>
<head>
<title>Angular Material Plunker</title>
<!-- Load common libraries -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/typescript/2.1.6/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.7.2/zone.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.47/system.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/web-animations/2.2.2/web-animations.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://rawgit.com/angular/material2-builds/master/prebuilt-themes/indigo-pink.css" rel="stylesheet">
<!-- Load Angular Material 2 stylesheet -->
<link href="theme.scss">
<style>
body {
font-family: Roboto, Arial, sans-serif; margin: 0
}
</style>
</head>
<body class="mat-app-background">
<material-app>Loading the Angular Material App...</material-app>
</body>
</html>
<!--
Copyright 2017 Google LLC. 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} from '@angular/core';
import {bootstrap} from '@angular/platform-browser-dynamic';
import {VERSION} from '@angular/material';
@Component({
selector: 'material-app',
templateUrl: 'app.component.html',
styleUrls: [ 'app.component.css' ]
})
export class AppComponent {
private version = VERSION;
}
/*
Copyright 2017 Google LLC. 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
*/
<mat-toolbar color="primary">
Angular Material Inputs and Themes
</mat-toolbar>
<div style="padding: 7px">
<form class="example-form">
<mat-form-field class="example-full-width">
<input matInput placeholder="Company (disabled)" disabled value="Google">
</mat-form-field>
<table class="example-full-width" cellspacing="0"><tr>
<td><mat-form-field class="example-full-width">
<input matInput placeholder="First name">
</mat-form-field></td>
<td colspan="2"><mat-form-field color="accent" class="example-full-width">
<input matInput placeholder="Long Last Name That Will Be Truncated">
</mat-form-field></td>
</tr>
<tr>
<td colspan="3">
<p>
<mat-form-field class="example-full-width">
<textarea matTextareaAutosize matInput placeholder="Address">1600 Amphitheatre Pkwy</textarea>
</mat-form-field>
<br>
<mat-form-field class="example-full-width">
<textarea matInput matTextareaAutosize placeholder="Address 2"></textarea>
</mat-form-field>
</p>
</td>
</tr>
<tr>
<td><mat-form-field class="example-full-width">
<input matInput placeholder="City">
</mat-form-field></td>
<td><mat-form-field class="example-full-width">
<input matInput placeholder="State">
</mat-form-field></td>
<td><mat-form-field class="example-full-width">
<input matInput #postalCode maxlength="5" placeholder="Postal Code" value="94043">
<mat-hint align="end">{{postalCode.value.length}} / 5</mat-hint>
</mat-form-field></td>
</tr></table>
</form>
</div>
<!--
Copyright 2017 Google LLC. 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
-->
/** 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/common': 'https://unpkg.com/@angular/common/bundles/common.umd.js',
'@angular/common/http': 'https://unpkg.com/@angular/common/bundles/common-http.umd.js',
'@angular/compiler': 'https://unpkg.com/@angular/compiler/bundles/compiler.umd.js',
'@angular/animations': "https://unpkg.com/@angular/animations/bundles/animations.umd.js",
'@angular/animations/browser': 'https://unpkg.com/@angular/animations/bundles/animations-browser.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/animations': 'https://unpkg.com/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'https://unpkg.com/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/material': 'https://rawgit.com/angular/material2-builds/master/bundles/material.umd.js',
'@angular/cdk': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk.umd.js',
// CDK Secondary entry points
'@angular/cdk/a11y': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-a11y.umd.js',
'@angular/cdk/accordion': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-accordion.umd.js',
'@angular/cdk/bidi': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-bidi.umd.js',
'@angular/cdk/coercion': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-coercion.umd.js',
'@angular/cdk/keycodes': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-keycodes.umd.js',
'@angular/cdk/observers': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-observers.umd.js',
'@angular/cdk/platform': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-platform.umd.js',
'@angular/cdk/portal': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-portal.umd.js',
'@angular/cdk/rxjs': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-rxjs.umd.js',
'@angular/cdk/table': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-table.umd.js',
'@angular/cdk/testing': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-testing.umd.js',
'@angular/cdk/overlay': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-overlay.umd.js',
'@angular/cdk/scrolling': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-scrolling.umd.js',
'@angular/cdk/collections': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-collections.umd.js',
'@angular/cdk/stepper': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-stepper.umd.js',
'@angular/cdk/layout': 'https://rawgit.com/angular/cdk-builds/master/bundles/cdk-layout.umd.js',
// Third party libraries
'tslib': 'https://unpkg.com/tslib@1.7.1',
'rxjs': 'https://unpkg.com/rxjs@5.5.2'
},
packages: {
// Thirdparty barrels.
'rxjs': { main: 'index' },
'rxjs/operators': {main: 'index'},
}
});
/*
Copyright 2017 Google LLC. 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 {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 {CommonModule} from '@angular/common';
import {HttpClientModule} from '@angular/common/http';
import {AppComponent} from './app.component';
import {CdkTableModule} from '@angular/cdk/table'
import {OverlayModule} from '@angular/cdk/overlay';
import {
MatAutocompleteModule,
MatButtonModule,
MatButtonToggleModule,
MatCardModule,
MatCheckboxModule,
MatChipsModule,
MatDatepickerModule,
MatDialogModule,
MatExpansionModule,
MatGridListModule,
MatIconModule,
MatInputModule,
MatListModule,
MatMenuModule,
MatNativeDateModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatRadioModule,
MatRippleModule,
MatSelectModule,
MatSidenavModule,
MatSliderModule,
MatSlideToggleModule,
MatSnackBarModule,
MatTabsModule,
MatToolbarModule,
MatTooltipModule,
MatSortModule,
MatPaginatorModule
} from '@angular/material';
/**
* NgModule that includes all Material modules that are required to serve
* the Plunker.
*/
@NgModule({
exports: [
// CDk
CdkTableModule,
OverlayModule,
// Material
MatAutocompleteModule,
MatButtonModule,
MatButtonToggleModule,
MatCardModule,
MatCheckboxModule,
MatChipsModule,
MatDatepickerModule,
MatDialogModule,
MatExpansionModule,
MatGridListModule,
MatIconModule,
MatInputModule,
MatListModule,
MatMenuModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatRadioModule,
MatRippleModule,
MatSelectModule,
MatSidenavModule,
MatSlideToggleModule,
MatSliderModule,
MatSnackBarModule,
MatTabsModule,
MatToolbarModule,
MatTooltipModule,
MatNativeDateModule,
MatSortModule,
MatPaginatorModule
]
})
export class PlunkerMaterialModule {}
@NgModule({
imports: [
BrowserModule,
CommonModule,
HttpClientModule,
PlunkerMaterialModule,
BrowserAnimationsModule
],
declarations: [AppComponent],
bootstrap: [AppComponent],
providers: []
})
export class PlunkerAppModule {}
platformBrowserDynamic().bootstrapModule(PlunkerAppModule);
/*
Copyright 2017 Google LLC. 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(theme.scss);
td{
padding-right: 1em;
padding-left: 1em;
border: solid #EEE 1px;
}
.example-form {
width: 500px;
}
.example-full-width {
width: 100%;
}
@import 'https://unpkg.com/@angular/material/theming';
@include mat-core();
$testing-green: (
50 : #eff3e1,
100 : #d7e1b3,
200 : #bdcd80,
300 : #a2b84d,
400 : #8ea927,
500 : #7a9a01,
600 : #729201,
700 : #678801,
800 : #5d7e01,
900 : #4a6c00,
A100 : #daff9c,
A200 : #c6ff69,
A400 : #b3ff36,
A700 : #aaff1c,
contrast: (
50 : #000000,
100 : #000000,
200 : #000000,
300 : #000000,
400 : #000000,
500 : #ffffff,
600 : #ffffff,
700 : #ffffff,
800 : #ffffff,
900 : #ffffff,
A100 : #000000,
A200 : #000000,
A400 : #000000,
A700 : #000000,
)
);
$testing-blue: (
50 : #e0eff9,
100 : #b3d6f1,
200 : #80bbe7,
300 : #4d9fdd,
400 : #268bd6,
500 : #0076cf,
600 : #006eca,
700 : #0063c3,
800 : #0059bd,
900 : #0046b2,
A100 : #dbe7ff,
A200 : #a8c4ff,
A400 : #75a1ff,
A700 : #5c90ff,
contrast: (
50 : #000000,
100 : #000000,
200 : #000000,
300 : #000000,
400 : #ffffff,
500 : #ffffff,
600 : #ffffff,
700 : #ffffff,
800 : #ffffff,
900 : #ffffff,
A100 : #000000,
A200 : #000000,
A400 : #000000,
A700 : #000000,
)
);
// Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker
// hue.
$testing-primary: mat-palette($testing-blue);
$testing-accent: mat-palette($testing-green, 500);
$testing-warn: mat-palette($mat-red);
$testing-theme: mat-light-theme($testing-primary, $testing-accent, $testing-warn);
@include angular-material-theme($testing-theme);
.alternate-theme {
$alternate-primary: mat-palette($mat-green);
$alternate-accent: mat-palette($mat-yellow);
$alternate-warn: mat-palette($mat-red);
$alternate-theme: mat-light-theme($alternate-primary, $alternate-accent, $alternate-warn);
@include angular-material-theme($alternate-theme);
}