【发布时间】:2023-03-31 22:35:01
【问题描述】:
我知道在 Angular 2
中包含组件的内部样式和外部样式import {Component} from 'angular2/core';
@Component({
selector: 'test',
templateUrl:'app/test.component.html',
styleUrls:['app/test.component.css']
})
export class AppComponent {
carparts = [
{
"id": 1,
"name": "Super Tires",
"description": "These tires are the very best",
"inStock": 5
},
{
"id": 2,
"name": "Reinforced Shocks",
"description": "Shocks made from kryptonite",
"inStock": 0
}];
totalCarParts(){
let sum = 0;
for (let carPart of this.carparts) {
sum += carPart.inStock;
}
return sum;
}
}
我想包含一些可以在我的整个应用程序中使用的通用 css,比如普通的 html。
是否有任何角度特定的方法或者这是正确的方法??
【问题讨论】:
-
把它放在
index.html我想说.. :) -
在右角没有具体的方法......