Skip to content

Instantly share code, notes, and snippets.

@zhentian-wan
Last active March 18, 2016 08:54
Show Gist options
  • Save zhentian-wan/5abea82a522413618cdd to your computer and use it in GitHub Desktop.
Save zhentian-wan/5abea82a522413618cdd to your computer and use it in GitHub Desktop.
Angular 2 -- Component directives
<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8>
<title>Intro to Angular 2</title>
<base href="/">
</head>
<body>
<app></app>
<script src="vendor.bundle.js"></script>
<script src="bundle.js"></script>
</body>
</html>
import {Component} from 'angular2/core';
import {bootstrap} from 'angular2/bootstrap';
import {TodoInput} from './todo-input';
@Component({
selector: 'app',
directives: [TodoInput],
template: `<todo-input></todo-input>`
})
class App{
}
bootstrap(App);
import {Component} from 'angular2/core';
@Component({
selector: 'todo-input',
template: `<input type="text"/>`
})
export class TodoInput{
}
import {Component} from 'angular2/core';
import {bootstrap} from 'angular2/bootstrap';
import {TodoInput} from './todo-input';
@Component({
selector: 'app',
directives: [TodoInput],
template: `<todo-input></todo-input>`
})
class App{
}
bootstrap(App);
import {Component} from 'angular2/core';
@Component({
selector: 'todo-input',
template: `<input type="text"/>`
})
export class TodoInput{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment