<!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="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">
<style>body { font-family: Roboto, Arial, sans-serif; margin: 0 }</style>
</head>
<body class="mat-app-background">
<material-app>Loading the Material md-select demo App...</material-app>
<h1>Moved</h1>
<p>
This is no longer maintained on Plunker, moved to StackBlitz checkout updated demo at <a target="_blank" href="https://stackblitz.com/edit/angular-material-select-demo">https://stackblitz.com/edit/angular-material-select-demo</a>
</p>
<div style="position: absolute; bottom: 10px; left: 10px;">
<a style="text-decoration: none; color: #000000;" href="https://github.com/joejordanbrown" target="_blank">GitHub</a>
</div>
<div style="position: absolute; bottom: 10px; right: 10px;">
<a style="text-decoration: none; color: #000000;" href="https://uixd.co.uk" target="_blank">Created by UIXD</a>
</div>
</body>
</html>
/* Styles go here */
### Angular Material md-select Examples - Typescript
[Created by UIXD](https://uixd.co.uk)
---------------------------------------------------------
## Checkout other examples on profile:
http://plnkr.co/users/joejordanbrown
https://stackblitz.com/@joejordanbrown
/** Add Transpiler for Typescript */
System.config({
transpiler: 'typescript',
typescriptOptions: {
emitDecoratorMetadata: true
},
packages: {
'.': {
defaultExtension: 'ts'
},
'vendor': {
defaultExtension: 'js'
}
}
});
System.config({
map: {
'main': 'src/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/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/cdk': 'https://unpkg.com/@angular/cdk/bundles/cdk.umd.js',
'@angular/cdk/a11y': 'https://unpkg.com/@angular/cdk/bundles/cdk-a11y.umd.js',
'@angular/cdk/bidi': 'https://unpkg.com/@angular/cdk/bundles/cdk-bidi.umd.js',
'@angular/cdk/coercion': 'https://unpkg.com/@angular/cdk/bundles/cdk-coercion.umd.js',
'@angular/cdk/collections': 'https://unpkg.com/@angular/cdk/bundles/cdk-collections.umd.js',
'@angular/cdk/keycodes': 'https://unpkg.com/@angular/cdk/bundles/cdk-keycodes.umd.js',
'@angular/cdk/observers': 'https://unpkg.com/@angular/cdk/bundles/cdk-observers.umd.js',
'@angular/cdk/overlay': 'https://unpkg.com/@angular/cdk/bundles/cdk-overlay.umd.js',
'@angular/cdk/platform': 'https://unpkg.com/@angular/cdk/bundles/cdk-platform.umd.js',
'@angular/cdk/portal': 'https://unpkg.com/@angular/cdk/bundles/cdk-portal.umd.js',
'@angular/cdk/rxjs': 'https://unpkg.com/@angular/cdk/bundles/cdk-rxjs.umd.js',
'@angular/cdk/scrolling': 'https://unpkg.com/@angular/cdk/bundles/cdk-scrolling.umd.js',
'@angular/cdk/table': 'https://unpkg.com/@angular/cdk/bundles/cdk-table.umd.js',
'@angular/material': 'https://unpkg.com/@angular/material/bundles/material.umd.js',
// Rxjs mapping
'rxjs': 'https://unpkg.com/rxjs',
},
packages: {
// Thirdparty barrels.
'rxjs': { main: 'index' },
}
});
/*
Copyright 2016 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 {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 {HttpModule} from '@angular/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import {MaterialModule} from '@angular/material';
import {AppComponent} from './app';
@NgModule({
imports: [
BrowserModule,
CommonModule,
HttpModule,
FormsModule,
ReactiveFormsModule,
MaterialModule,
BrowserAnimationsModule
],
declarations: [AppComponent],
bootstrap: [AppComponent],
providers: []
})
export class PlunkerAppModule {}
platformBrowserDynamic().bootstrapModule(PlunkerAppModule);
/*
Copyright 2016 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 } from '@angular/core'
import { FormControl } from '@angular/forms';
@Component({
selector: 'material-app',
template: `
<md-toolbar color="primary">
Angular Material - md-select examples
</md-toolbar>
<div style="padding: 20px;">
<h1>Model Forms</h1>
<div style="padding: 0 0 20px 20px">
<h3>Value string</h3>
<md-select name="countryString" [(ngModel)]="selectedCountry" placeholder="Country">
<md-option [value]="'GB'">Great Britain</md-option>
<md-option [value]="'US'">United States</md-option>
<md-option [value]="'CA'">Canada</md-option>
</md-select>
Selected = {{selectedCountry}}
</div>
<div style="padding: 20px">
<h3>Value variable</h3>
<md-select name="countryVaraible" [(ngModel)]="selectedCountry" placeholder="Country">
<md-option *ngFor="let country of countries" [value]="country.short">
{{country.full}}
</md-option>
</md-select>
Selected = {{selectedCountry}}
</div>
<h1>Reactive Forms</h1>
<div style="padding: 0 0 20px 20px">
<h3>Value string</h3>
<md-select name="countryReactiveString" [formControl]="selectedCountryControl" placeholder="Country">
<md-option [value]="'GB'">Great Britain</md-option>
<md-option [value]="'US'">United States</md-option>
<md-option [value]="'CA'">Canada</md-option>
</md-select>
Selected = {{selectedCountryControl.value}}
</div>
<div style="padding: 20px">
<h3>Value variable</h3>
<md-select name="countryReactiveVaraible" [formControl]="selectedCountryControl" placeholder="Country">
<md-option *ngFor="let country of countries" [value]="country.short">
{{country.full}}
</md-option>
</md-select>
Selected = {{selectedCountryControl.value}}
</div>
</div>
`,
})
export class AppComponent {
name:string;
constructor() {
this.name = 'Angular2'
}
countries: any = [{full: "Great Britain", short: "GB"}, {full: "United States", short: "US"}, {full: "Canada", short: "CA"}];
selectedCountry: string = "GB";
selectedCountryControl = new FormControl(this.selectedCountry);
}