《Angular学习八》样式和属性
样式的定义和之前CSS样式定义一样,在./app.component.scss定义好样式即可,例子:
.title{ color: red;}
在页面中使用样式./app.component.html
<h1 class=”title”>nihao {{title}} 今年{{getage()}}</h1>
在组件中,定义属性和方法,也可以在界面中显示 app.component.ts
export class AppComponent { title = ‘app’; getage(){ return ’33’; }}
结果:

近期评论