chore: rename modules/examples to modules/playground

The directory contains code authored in a style that makes it transpilable to dart. As such, these are not idiomatic examples of Angular 2 usage.

The main purpose of this directory is to enable experimentation with Angular within the angular/angular repository.

Closes #4342

Closes #4639
This commit is contained in:
kutyel
2015-10-10 00:25:17 +02:00
committed by Flavio Corpa Ríos
parent c3ab20cc87
commit e4e74ae65c
248 changed files with 190 additions and 190 deletions

View File

@ -0,0 +1,26 @@
<!doctype html>
<html>
<title>Key events</title>
<style>
.sample-area {
text-align: center;
margin: 5px;
height: 50px;
line-height: 50px;
border-radius: 5px;
border: 1px solid #d0d0d0;
}
.sample-area:focus {
border: 1px solid blue;
color: blue;
font-weight: bold;
}
</style>
<body>
<key-events-app>
Loading...
</key-events-app>
$SCRIPTS$
</body>
</html>

View File

@ -0,0 +1,36 @@
import {bootstrap} from 'angular2/bootstrap';
import {Component, View} from 'angular2/core';
import {KeyEventsPlugin} from 'angular2/src/core/render/dom/events/key_events';
@Component({selector: 'key-events-app'})
@View({
template: `Click in the following area and press a key to display its name:<br>
<div (keydown)="onKeyDown($event)" class="sample-area" tabindex="0">{{lastKey}}</div><br>
Click in the following area and press shift.enter:<br>
<div
(keydown.shift.enter)="onShiftEnter($event)"
(click)="resetShiftEnter()"
class="sample-area"
tabindex="0"
>{{shiftEnter ? 'You pressed shift.enter!' : ''}}</div>`
})
class KeyEventsApp {
lastKey: string = '(none)';
shiftEnter: boolean = false;
onKeyDown(event): void {
this.lastKey = KeyEventsPlugin.getEventFullKey(event);
event.preventDefault();
}
onShiftEnter(event): void {
this.shiftEnter = true;
event.preventDefault();
}
resetShiftEnter(): void { this.shiftEnter = false; }
}
export function main() {
bootstrap(KeyEventsApp);
}