1 内联样式
/*** Created by Administrator on /7/23.*/import {Component, View, NgIf} from 'angular2/angular2';@Component({selector: 'ng-test',properties: ['showElement']})@View({styles:['div.normal-text{width:100px;height:50px;border:1px solid gray;}'],template: `<div class="normal-text">ngff-test</div><div *ng-if="showElement">hide-element</div>`,directives: [NgIf]})export class NgTest {//showElement:boolean;constructor() {//this.showElement = true;}}
2 外部文件 use styleUrls:['','','']
/*** Created by Administrator on /7/23.*/import {Component, View, NgIf} from 'angular2/angular2';@Component({selector: 'ng-test',properties: ['showElement']})@View({styleUrls:['../../css/index.css'],template: `<div class="normal-text">ngff-test</div><div *ng-if="showElement">hide-element</div>`,directives: [NgIf]})export class NgTest {//showElement:boolean;constructor() {//this.showElement = true;}}