Created
June 11, 2019 21:53
-
-
Save 2014maximo/53d36bff51ac709ae5a25b9324395c63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@@@@ @ | |
@ @ | |
@ @@@@ @ @@@ @@@@ | |
@ @@ @@ @ @@ @ @@ @ | |
@ @ @ @ @ @@@@@ @ @ | |
@ @ @ @@ @ @ @ | |
@ @@ @@ @ @ @@ @ @ | |
@ @@@@ @ @ @@@@ @ @ | |
//EN EL SERVICIO | |
import { Injectable } from '@angular/core'; | |
import { HttpClient, HttpHeaders } from '@angular/common/http'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class SpotifyService { | |
constructor(private http: HttpClient) { | |
console.log('Spotify Service listo'); | |
} | |
getNewReleases(){ | |
const headers = new HttpHeaders({ | |
'Authorization': 'Bearer BQDerv7OUUzUZZmmOh5LLP3QTrXa9EYIpyClps5PoqE8wK5MesEq1v0KcGSgNUwSVYc3Q7EYmzPK3a1EIvo' | |
}); | |
this.http.get('https://api.spotify.com/v1/browse/new-releases', { headers }) | |
.subscribe(data => { | |
console.log(data); | |
}); | |
} | |
} | |
//EN EL elemento.component.ts: | |
import { Component, OnInit } from '@angular/core'; | |
import { SpotifyService } from '../../services/spotify.service'; | |
@Component({ | |
selector: 'app-home', | |
templateUrl: './home.component.html', | |
styles: [] | |
}) | |
export class HomeComponent { | |
constructor( private spotify: SpotifyService ) { | |
this.spotify.getNewReleases(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment