<!DOCTYPE html>
<html>
<head>
<title>angular2 playground</title>
<link rel="stylesheet" href="style.css" />
<script src="https://code.angularjs.org/2.0.0-beta.0/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="config.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.0/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.0/angular2.min.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.0/http.min.js"></script>
<script>
System.import('app')
.catch(console.error.bind(console));
</script>
</head>
<body>
<my-component>
loading...
</my-component>
<p style="margin-top: 50px;">Note: For the sake of the plunker, the log is now an alert.</p>
</body>
</html>
/* Styles go here */
### Angular2 Starter Plunker - Typescript - Beta 0
A simple plunker demonstrating Angular2 usage:
- Uses SystemJS + TypeScript to compile on the fly
- Includes binding, directives, http, pipes, and DI usage.
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
//map tells the System loader where to look for things
map: {
app: "./src"
},
//packages defines our app package
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
}
}
});
import {bootstrap} from 'angular2/platform/browser';
import {MyComponent} from './mycomponent';
bootstrap(MyComponent);
import {Component} from 'angular2/core';
import {Tooltip} from './tooltip';
@Component({
selector: 'my-component',
template: `<div [tooltip]="message">A tooltip with custom message</div>`,
directives: [Tooltip]
})
export class MyComponent {
message: string;
constructor() {
this.message = 'tooltip text';
}
}
import {Directive, Input} from 'angular2/core';
@Directive({
selector: '[tooltip]',
host: {
'(mouseover)': 'show()'
}
})
export class Tooltip {
@Input('tooltip') text: string;
show() {
alert(this.text);
}
}