Karthikeyan sundaramoorthi Karthikeyan sundaramoorthi - 1 year ago 121
HTML Question

angular 2 include css file common to all pages

I know to include internal styles and include external style for a component in Angular 2

import {Component} from 'angular2/core';

selector: 'test',
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

let sum = 0;
for (let carPart of this.carparts) {
sum += carPart.inStock;
return sum;

I want to include some common css that could be used over my entire application like normal html.

Is there any angular specific way of doing it or this is the proper way??

Answer Source


<!DOCTYPE html>
<html ng-app="app" ng-controller="AppController">
    <link rel="stylesheet" href="styles/sheet.css"/>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download