angular-cn/aio/content/examples/component-styles/ts/plnkr.no-link.html

409 lines
11 KiB
HTML
Raw Normal View History

<html lang="en"><head></head><body><form id="mainForm" method="post" action="http://plnkr.co/edit/?p=preview" target="_self"><input type="hidden" name="files[app/app.module.ts]" value="import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HeroAppComponent } from './hero-app.component';
import { HeroAppMainComponent } from './hero-app-main.component';
import { HeroDetailsComponent } from './hero-details.component';
import { HeroControlsComponent } from './hero-controls.component';
import { QuestSummaryComponent } from './quest-summary.component';
import { HeroTeamComponent } from './hero-team.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [
HeroAppComponent,
HeroAppMainComponent,
HeroDetailsComponent,
HeroControlsComponent,
QuestSummaryComponent,
HeroTeamComponent
],
bootstrap: [ HeroAppComponent ]
})
export class AppModule { }
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/hero-app-main.component.ts]" value="import { Component, Input } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'hero-app-main',
template: `
<quest-summary></quest-summary>
<hero-details [hero]=hero [class.active]=hero.active>
<hero-controls [hero]=hero></hero-controls>
</hero-details>
`
})
export class HeroAppMainComponent {
@Input() hero: Hero;
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/hero-app.component.ts]" value="import { Component, HostBinding } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'hero-app',
template: `
<h1>Tour of Heroes</h1>
<hero-app-main [hero]=hero></hero-app-main>`,
styles: ['h1 { font-weight: normal; }']
})
export class HeroAppComponent {
hero = new Hero(
'Human Torch',
['Mister Fantastic', 'Invisible Woman', 'Thing']
);
@HostBinding('class') get themeClass() {
return 'theme-light';
}
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/hero-controls.component.ts]" value="import { Component, Input } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'hero-controls',
template: `
<style>
button {
background-color: white;
border: 1px solid #777;
}
</style>
<h3>Controls</h3>
<button (click)=&quot;activate()&quot;>Activate</button>
`
})
export class HeroControlsComponent {
@Input() hero: Hero;
activate() {
this.hero.active = true;
}
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/hero-details.component.ts]" value="import { Component, Input } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'hero-details',
template: `
<h2>{{hero.name}}</h2>
<hero-team [hero]=hero></hero-team>
<ng-content></ng-content>
`,
styleUrls: ['app/hero-details.component.css']
})
export class HeroDetailsComponent {
@Input() hero: Hero;
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/hero-team.component.ts]" value="import { Component, Input } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'hero-team',
template: `
<link rel=&quot;stylesheet&quot; href=&quot;app/hero-team.component.css&quot;>
<h3>Team</h3>
<ul>
<li *ngFor=&quot;let member of hero.team&quot;>
{{member}}
</li>
</ul>`
})
export class HeroTeamComponent {
@Input() hero: Hero;
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/hero.ts]" value="export class Hero {
active: boolean;
constructor(public name: string,
public team: string[]) {
}
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/quest-summary.component.ts]" value="/* tslint:disable:no-unused-variable */
import { Component, ViewEncapsulation } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'quest-summary',
templateUrl: './quest-summary.component.html',
styleUrls: ['./quest-summary.component.css']
})
export class QuestSummaryComponent { }
/*
// warning: few browsers support shadow DOM encapsulation at this time
encapsulation: ViewEncapsulation.Native
*/
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[main.ts]" value="import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/hero-details-box.css]" value=":host {
padding: 10px;
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/hero-details.component.css]" value="@import 'hero-details-box.css';
:host {
display: block;
border: 1px solid black;
}
:host(.active) {
border-width: 3px;
}
:host-context(.theme-light) h2 {
background-color: #eef;
}
:host /deep/ h3 {
font-style: italic;
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/hero-team.component.css]" value="li {
list-style-type: square;
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/quest-summary.component.css]" value=":host {
display: block;
background-color: green;
color: white;
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[styles.css]" value="/* Master Styles */
h1 {
color: #369;
font-family: Arial, Helvetica, sans-serif;
font-size: 250%;
}
h2, h3 {
color: #444;
font-family: Arial, Helvetica, sans-serif;
font-weight: lighter;
}
body {
margin: 2em;
}
body, input[text], button {
color: #888;
font-family: Cambria, Georgia;
}
a {
cursor: pointer;
cursor: hand;
}
button {
font-family: Arial;
background-color: #eee;
border: none;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
cursor: hand;
}
button:hover {
background-color: #cfd8dc;
}
button:disabled {
background-color: #eee;
color: #aaa;
cursor: auto;
}
/* Navigation link styles */
nav a {
padding: 5px 10px;
text-decoration: none;
margin-right: 10px;
margin-top: 10px;
display: inline-block;
background-color: #eee;
border-radius: 4px;
}
nav a:visited, a:link {
color: #607D8B;
}
nav a:hover {
color: #039be5;
background-color: #CFD8DC;
}
nav a.active {
color: #039be5;
}
/* items class */
.items {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 24em;
}
.items li {
cursor: pointer;
position: relative;
left: 0;
background-color: #EEE;
margin: .5em;
padding: .3em 0;
height: 1.6em;
border-radius: 4px;
}
.items li:hover {
color: #607D8B;
background-color: #DDD;
left: .1em;
}
.items li.selected {
background-color: #CFD8DC;
color: white;
}
.items li.selected:hover {
background-color: #BBD8DC;
}
.items .text {
position: relative;
top: -3px;
}
.items .badge {
display: inline-block;
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
background-color: #607D8B;
line-height: 1em;
position: relative;
left: -1px;
top: -4px;
height: 1.8em;
margin-right: .8em;
border-radius: 4px 0 0 4px;
}
/* everywhere else */
* {
font-family: Arial, Helvetica, sans-serif;
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/quest-summary.component.html]" value="<p>No quests in progress</p>
<!--
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->"><input type="hidden" name="files[index.html]" value="<!DOCTYPE html>
<html>
<head>
<meta charset=&quot;UTF-8&quot;>
<title>Component Styles</title>
<script>document.write('<base href=&quot;' + document.location + '&quot; />');</script>
<meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;>
<link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;>
<!-- Polyfills -->
<script src=&quot;https://unpkg.com/core-js/client/shim.min.js&quot;></script>
<script src=&quot;https://unpkg.com/zone.js@0.7.4?main=browser&quot;></script>
<script src=&quot;https://unpkg.com/systemjs@0.19.39/dist/system.src.js&quot;></script>
<script src=&quot;https://cdn.rawgit.com/angular/angular.io/b3c65a9/public/docs/_examples/_boilerplate/systemjs.config.web.js&quot;></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<h1 style=&quot;visibility: hidden;&quot;>External H1 Title for E2E test</h1>
<hero-app></hero-app>
<button style=&quot;visibility: hidden;&quot;>External button for E2E test</button>
<ul style=&quot;visibility: hidden;&quot;>
<li>External list for E2E test</li>
</ul>
</body>
</html>
<!--
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->"><input type="hidden" name="tags[0]" value="angular"><input type="hidden" name="tags[1]" value="example"><input type="hidden" name="tags[2]" value="CSS"><input type="hidden" name="private" value="true"><input type="hidden" name="description" value="Angular Example - Component Styles"></form><script>document.getElementById("mainForm").submit();</script></body></html>