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;"> }
`]
})