diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 2b4ee75..d65b5cd 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -7,9 +7,9 @@ import { AlbumsComponent } from './components/albums/albums.component';
const routes: Routes = [
{ path: '', component: HomeComponent },
{ path: 'artists/:id', component: ArtistsComponent },
- { path: 'artists/', component: ArtistsComponent },
+ { path: 'artists', component: ArtistsComponent },
{ path: 'albums/:id', component: AlbumsComponent },
- { path: 'albums/', component: AlbumsComponent }
+ { path: 'albums', component: AlbumsComponent }
];
@NgModule({
diff --git a/src/app/components/artists/artists.component.html b/src/app/components/artists/artists.component.html
index e1b29e9..3283436 100644
--- a/src/app/components/artists/artists.component.html
+++ b/src/app/components/artists/artists.component.html
@@ -1 +1,33 @@
-
artists works!
+
+
+
+
+
+
+
+
+
+
+
{{ data.result[0].name }}'s profile
+
+
{{ data.result[0].name }}'s albums
+
+
+
{{ data.result[0].name }}'s songs
+
+
+
+
+
diff --git a/src/app/components/artists/artists.component.ts b/src/app/components/artists/artists.component.ts
index 038905a..8b04530 100644
--- a/src/app/components/artists/artists.component.ts
+++ b/src/app/components/artists/artists.component.ts
@@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core';
+import { DataService } from 'src/app/services/data.service';
+import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-artists',
@@ -7,9 +9,33 @@ import { Component, OnInit } from '@angular/core';
})
export class ArtistsComponent implements OnInit {
- constructor() { }
+ artistData;
+ artists;
+
+ constructor(
+ private data: DataService,
+ private route: ActivatedRoute
+ ) { }
ngOnInit() {
+
+ this.route.paramMap.subscribe(params => {
+
+ // If the id argument is given...
+ if (params.has('id')) {
+
+ // ... then get artist data ...
+ this.artistData = this.data.getArtist(params.get('id'));
+
+ } else {
+
+ // Otherwise, get all artists and list them out.
+ this.artists = this.data.getAllArtists();
+
+ }
+
+ });
+
}
}