angular2和typescript 和npm

angular2需要用到typescript   和 npm
 
下载项目 到本地文件夹switching-to-angular2
2. cd  switching-to-angular2
3. npm install 下载
5. npm start启动后,就可以访问下载的项目中的路径 http://localhost:5555/dist/dev  可以看到项目的列表
 
 
 
组件里可以包含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;"> }
`]
})
 
 
 
原文地址:https://www.cnblogs.com/-simplelife/p/8608863.html