Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
luna
Commits
d70618ae
Commit
d70618ae
authored
Aug 30, 2017
by
i317280
Committed by
liuzheng712
Aug 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
29432a53
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
26 deletions
+97
-26
app.component.css
src/app/app.component.css
+47
-0
app.component.html
src/app/app.component.html
+15
-18
app.component.ts
src/app/app.component.ts
+27
-1
app.module.ts
src/app/app.module.ts
+8
-7
No files found.
src/app/app.component.css
View file @
d70618ae
.selected
{
background-color
:
#CFD8DC
!important
;
color
:
white
;
}
.heroes
{
margin
:
0
0
2em
0
;
list-style-type
:
none
;
padding
:
0
;
width
:
15em
;
}
.heroes
li
{
cursor
:
pointer
;
position
:
relative
;
left
:
0
;
background-color
:
#EEE
;
margin
:
.5em
;
padding
:
.3em
0
;
height
:
1.6em
;
border-radius
:
4px
;
}
.heroes
li
.selected
:hover
{
background-color
:
#BBD8DC
!important
;
color
:
white
;
}
.heroes
li
:hover
{
color
:
#607D8B
;
background-color
:
#DDD
;
left
:
.1em
;
}
.heroes
.text
{
position
:
relative
;
top
:
-3px
;
}
.heroes
.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
;
}
src/app/app.component.html
View file @
d70618ae
<!--The content below is only a placeholder and can be replaced.-->
<h1>
{{title}}
</h1>
<div
style=
"text-align:center"
>
<h2>
My Heroes
</h2>
<h1>
<ul
class=
"heroes"
>
Welcome to {{title}}!
<li
*
ngFor=
"let hero of heroes"
</h1>
[
class
.
selected
]="
hero =
==
selectedHero
"
<img
width=
"300"
src=
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAyNTAgMjUwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNTAgMjUwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDojREQwMDMxO30NCgkuc3Qxe2ZpbGw6I0MzMDAyRjt9DQoJLnN0MntmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnPg0KCTxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMTI1LDMwIDEyNSwzMCAxMjUsMzAgMzEuOSw2My4yIDQ2LjEsMTg2LjMgMTI1LDIzMCAxMjUsMjMwIDEyNSwyMzAgMjAzLjksMTg2LjMgMjE4LjEsNjMuMiAJIi8+DQoJPHBvbHlnb24gY2xhc3M9InN0MSIgcG9pbnRzPSIxMjUsMzAgMTI1LDUyLjIgMTI1LDUyLjEgMTI1LDE1My40IDEyNSwxNTMuNCAxMjUsMjMwIDEyNSwyMzAgMjAzLjksMTg2LjMgMjE4LjEsNjMuMiAxMjUsMzAgCSIvPg0KCTxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik0xMjUsNTIuMUw2Ni44LDE4Mi42aDBoMjEuN2gwbDExLjctMjkuMmg0OS40bDExLjcsMjkuMmgwaDIxLjdoMEwxMjUsNTIuMUwxMjUsNTIuMUwxMjUsNTIuMUwxMjUsNTIuMQ0KCQlMMTI1LDUyLjF6IE0xNDIsMTM1LjRIMTA4bDE3LTQwLjlMMTQyLDEzNS40eiIvPg0KPC9nPg0KPC9zdmc+DQo="
>
(
click
)="
onSelect
(
hero
)"
>
</div>
<span
class=
"badge"
>
{{hero.id}}
</span>
{{hero.name}}
<h2>
Here are some links to help you start:
</h2>
<ul>
<li>
<h2><a
target=
"_blank"
href=
"https://angular.io/tutorial"
>
Tour of Heroes
</a></h2>
</li>
<li>
<h2><a
target=
"_blank"
href=
"https://github.com/angular/angular-cli/wiki"
>
CLI Documentation
</a></h2>
</li>
<li>
<h2><a
target=
"_blank"
href=
"https://blog.angular.io//"
>
Angular blog
</a></h2>
</li>
</li>
</ul>
</ul>
<div
*
ngIf=
"selectedHero"
>
<h2>
{{selectedHero.name}} details!
</h2>
<div><label>
id:
</label>
{{selectedHero.id}}
</div>
<div>
<label>
name:
</label>
<input
[(
ngModel
)]="
selectedHero
.
name
"
placeholder=
"name"
/>
</div>
</div>
src/app/app.component.ts
View file @
d70618ae
import
{
Component
}
from
'@angular/core'
;
import
{
Component
}
from
'@angular/core'
;
export
class
Hero
{
id
:
number
;
name
:
string
;
}
const
HEROES
:
Hero
[]
=
[
{
id
:
11
,
name
:
'Mr. Nice'
},
{
id
:
12
,
name
:
'Narco'
},
{
id
:
13
,
name
:
'Bombasto'
},
{
id
:
14
,
name
:
'Celeritas'
},
{
id
:
15
,
name
:
'Magneta'
},
{
id
:
16
,
name
:
'RubberMan'
},
{
id
:
17
,
name
:
'Dynama'
},
{
id
:
18
,
name
:
'Dr IQ'
},
{
id
:
19
,
name
:
'Magma'
},
{
id
:
20
,
name
:
'Tornado'
}
];
@
Component
({
@
Component
({
selector
:
'app-root'
,
selector
:
'app-root'
,
templateUrl
:
'./app.component.html'
,
templateUrl
:
'./app.component.html'
,
styleUrls
:
[
'./app.component.css'
]
styleUrls
:
[
'./app.component.css'
]
})
})
export
class
AppComponent
{
export
class
AppComponent
{
title
=
'app'
;
title
=
'Tour of Heroes'
;
heroes
=
HEROES
;
selectedHero
:
Hero
;
onSelect
(
hero
:
Hero
):
void
{
this
.
selectedHero
=
hero
;
}
}
}
src/app/app.module.ts
View file @
d70618ae
import
{
NgModule
}
from
'@angular/core'
;
import
{
BrowserModule
}
from
'@angular/platform-browser'
;
import
{
BrowserModule
}
from
'@angular/platform-browser'
;
import
{
NgModule
}
from
'@angular/core'
;
import
{
FormsModule
}
from
'@angular/forms'
;
// <-- NgModel lives here
import
{
AppComponent
}
from
'./app.component'
;
import
{
AppComponent
}
from
'./app.component'
;
@
NgModule
({
@
NgModule
({
imports
:
[
BrowserModule
,
FormsModule
// <-- import the FormsModule before binding with [(ngModel)]
],
declarations
:
[
declarations
:
[
AppComponent
AppComponent
],
],
imports
:
[
bootstrap
:
[
AppComponent
]
BrowserModule
],
providers
:
[],
bootstrap
:
[
AppComponent
]
})
})
export
class
AppModule
{
}
export
class
AppModule
{
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment