Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Descomps
Ntiers-angular
Commits
379d9da3
Commit
379d9da3
authored
3 years ago
by
Descomps
Browse files
Options
Download
Email Patches
Plain Diff
"test list pictures"
parent
fa266625
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/app/components/diapo/diapo.component.html
+0
-20
src/app/components/diapo/diapo.component.html
src/app/components/pictures-list/pictures-list.component.html
+13
-6
...app/components/pictures-list/pictures-list.component.html
src/app/components/pictures-list/pictures-list.component.ts
+8
-0
src/app/components/pictures-list/pictures-list.component.ts
src/app/models/picture.model.ts
+4
-4
src/app/models/picture.model.ts
with
25 additions
and
30 deletions
+25
-30
src/app/components/diapo/diapo.component.html
+
0
-
20
View file @
379d9da3
<ngb-carousel
*ngFor=
"let picture of pictures"
>
<ng-template
ngbSlide
>
<div
class=
"picsum-img-wrapper"
>
<img
[src]=
"picture.imagePath"
alt=
"Random first slide"
>
</div>
<div
class=
"carousel-caption"
>
<h3>
First slide label
</h3>
<p>
Nulla vitae elit libero, a pharetra augue mollis interdum.
</p>
</div>
</ng-template>
<ng-template
ngbSlide
>
<div
class=
"picsum-img-wrapper"
>
<img
[src]=
"picture.imagePath"
alt=
"Random second slide"
>
</div>
<div
class=
"carousel-caption"
>
<h3>
Second slide label
</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
</div>
</ng-template>
</ngb-carousel>
This diff is collapsed.
Click to expand it.
src/app/components/pictures-list/pictures-list.component.html
+
13
-
6
View file @
379d9da3
<h1>
All Pictures
</h1>
<hr
/>
<div
*ngIf=
"pictures.length > 0"
>
<div
*ngFor=
"let picture of pictures"
class=
"picture"
>
<img
[src]=
"picture.imagePath"
[alt]=
"picture.name"
/>
<div>
<span>
{{ picture.name }}
</span>
</div>
</div>
<ul
class=
"list-group"
>
<li
class=
"list-group-item"
*ngFor=
"let picture of pictures; let i = index"
[class.active]=
"i == currentIndex"
(click)=
"setActivePicture(picture, i)"
>
<img
[src]=
"picture.imagePath"
[alt]=
"picture.name"
[class.active]=
"i == currentIndex"
(click)=
"setActivePicture(picture, i)"
/>
{{picture.name}}
</li>
</ul>
</div>
This diff is collapsed.
Click to expand it.
src/app/components/pictures-list/pictures-list.component.ts
+
8
-
0
View file @
379d9da3
...
...
@@ -11,6 +11,8 @@ import {PictureService} from "../../services/picture.service";
export
class
PicturesListComponent
implements
OnInit
,
OnDestroy
{
pictures
:
Picture
[]
=
[];
currentPicture
:
Picture
=
{};
currentIndex
=
-
1
;
private
pictureSubscription
:
Subscription
|
undefined
;
...
...
@@ -25,6 +27,12 @@ export class PicturesListComponent implements OnInit, OnDestroy {
});
}
setActivePicture
(
picture
:
Picture
,
index
:
number
):
void
{
this
.
currentPicture
=
picture
;
this
.
currentIndex
=
index
;
}
ngOnDestroy
():
void
{
this
.
pictureSubscription
?.
unsubscribe
();
}
...
...
This diff is collapsed.
Click to expand it.
src/app/models/picture.model.ts
+
4
-
4
View file @
379d9da3
export
interface
Picture
{
_id
:
string
;
name
:
string
;
imagePath
:
string
;
export
class
Picture
{
_id
?
:
string
;
name
?
:
string
;
imagePath
?
:
string
;
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help