angular2须要用到typescript 和 npm
下载项目 到本地文件夹switching-to-angular2
2. cd switching-to-angular2
3. npm install 下载
组件里能够包含template 模板, templateUrl 指向一个页面url,指令dirctives,样式style
@Component({
selector: "carTag",
template: `<h3 class="titles">Mother Car Component</h3>
<input type ="text" #textInput bind-value="text" />
<button on-click="onCarChange(textInput.value)">Change</button>`,
directives: [door],
styles:[ `
.titles {color:#0099FF }
.child-style {
background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"> }
`]
})