Skip to content

Commit 9662b97

Browse files
committed
Things would display...
If it weren't for Angular's DOM sanitization. Working on that
1 parent 97aa525 commit 9662b97

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/app/data.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ export class DataService {
2727
fetchPics(){
2828
return this.http.get('/data/pics.json')
2929
}
30+
// Added this for testing without using WAMP
3031
fetchMusic(){
32+
return this.http.get('/data/music.json')
33+
}
34+
fetchMusicPHP(){
3135
return this.http.get('/app/music/music.php')
3236
}
33-
3437
}

src/app/music/music.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h1 class="display-3">Music</h1>
88
<div class="row">
99
<div class="col-md-12">
1010
<ng-container *ngFor="let tune of tunes">
11-
{{tune.SoundCloudEmbed}}
11+
<div class="e2e-trusted-url" [innerHTML]='tune.SoundCloudEmbed'></div>
1212
</ng-container>
1313
</div>
1414
</div>

src/app/music/music.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@ export class MusicComponent implements OnInit {
1414
constructor(private dataService: DataService) { }
1515

1616
ngOnInit() {
17-
this.phpGetMusic();
17+
//this.phpGetMusic();
18+
this.getMusic();
1819
}
1920

20-
phpGetMusic() {
21+
// Added this for testing without using WAMP
22+
getMusic(){
2123
this.dataService.fetchMusic().subscribe(
2224
(data) => this.tunes = data
2325
);
2426
}
2527

28+
phpGetMusic() {
29+
this.dataService.fetchMusicPHP().subscribe(
30+
(data) => this.tunes = data
31+
);
32+
}
2633
}

src/app/music/music.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
//There's no reason this file should exist
3+
//Requirement: Use PHP - achieved
24

35
// Read JSON file
46
$json = file_get_contents('../../data/music.json');

0 commit comments

Comments
 (0)