Skip to content

Commit 528a7eb

Browse files
committed
Hot damn it works
Used pipes and domsanitizer to get my stuff working
1 parent 9662b97 commit 528a7eb

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {LoggingService} from './logging.service';
77
import {DataService} from './data.service';
88
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
99
import { Ng4TwitterTimelineModule } from 'ng4-twitter-timeline/lib/index';
10+
import { EscapeHtmlPipe } from './keep-html.pipe';
1011

1112
import { AppComponent } from './app.component';
1213
import { HomeComponent } from './home/home.component';
@@ -46,7 +47,8 @@ const APP_ROUTES : Routes = [
4647
SpecialsComponent,
4748
GalleryComponent,
4849
SubmitComponent,
49-
MusicComponent
50+
MusicComponent,
51+
EscapeHtmlPipe
5052
],
5153
imports: [
5254
BrowserModule,

src/app/keep-html.pipe.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Pipe, PipeTransform } from '@angular/core';
2+
import { DomSanitizer } from '@angular/platform-browser';
3+
4+
@Pipe({ name: 'keepHtml', pure: false })
5+
export class EscapeHtmlPipe implements PipeTransform {
6+
constructor(private sanitizer: DomSanitizer) {
7+
}
8+
9+
transform(content) {
10+
return this.sanitizer.bypassSecurityTrustHtml(content);
11+
}
12+
}

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-
<div class="e2e-trusted-url" [innerHTML]='tune.SoundCloudEmbed'></div>
11+
<div [innerHTML]='tune.SoundCloudEmbed | keepHtml'></div>
1212
</ng-container>
1313
</div>
1414
</div>

src/app/music/music.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export class MusicComponent implements OnInit {
1111

1212
tunes:any = [];
1313

14-
constructor(private dataService: DataService) { }
14+
constructor(private dataService: DataService) {
15+
}
1516

1617
ngOnInit() {
1718
//this.phpGetMusic();

0 commit comments

Comments
 (0)