|
|
@ -1,6 +1,7 @@
|
|
|
|
import { Component, Input, ViewEncapsulation, OnInit } from "@angular/core";
|
|
|
|
import { Component, Input, ViewEncapsulation, OnInit } from "@angular/core";
|
|
|
|
import { IReleaseGroups } from "../../../../../interfaces/IMusicSearchResultV2";
|
|
|
|
import { IReleaseGroups } from "../../../../../interfaces/IMusicSearchResultV2";
|
|
|
|
import { SearchV2Service } from "../../../../../services/searchV2.service";
|
|
|
|
import { SearchV2Service } from "../../../../../services/searchV2.service";
|
|
|
|
|
|
|
|
import { ActivatedRoute } from "@angular/router";
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
templateUrl: "./artist-release-panel.component.html",
|
|
|
|
templateUrl: "./artist-release-panel.component.html",
|
|
|
@ -14,9 +15,20 @@ export class ArtistReleasePanel implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
public albums: IReleaseGroups[];
|
|
|
|
public albums: IReleaseGroups[];
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private searchService: SearchV2Service) { }
|
|
|
|
constructor(private searchService: SearchV2Service, private route: ActivatedRoute) {
|
|
|
|
|
|
|
|
route.params.subscribe(() => {
|
|
|
|
|
|
|
|
// This is due to when we change the music Id, NgOnInit is not called again
|
|
|
|
|
|
|
|
// Since the component has not been destroyed (We are not navigating away)
|
|
|
|
|
|
|
|
// so we need to subscribe to custom changes so we can do the data manulipulation below
|
|
|
|
|
|
|
|
this.loadAlbums();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ngOnInit() {
|
|
|
|
public ngOnInit() {
|
|
|
|
|
|
|
|
this.loadAlbums();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private loadAlbums(): void {
|
|
|
|
this.albums = this.releases.filter(x => x.type === "Album");
|
|
|
|
this.albums = this.releases.filter(x => x.type === "Album");
|
|
|
|
|
|
|
|
|
|
|
|
this.albums.forEach(a => {
|
|
|
|
this.albums.forEach(a => {
|
|
|
|