Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. @Injectable()
  2. export class SlidesService {
  3.  
  4. private requestUrl: string;
  5.  
  6. constructor(
  7. @Inject(AppConfig) private config: AppConfig,
  8. @Inject(HttpClient) private http: HttpClient) {
  9. this.requestUrl = this.config.restRoot + listSlidesUrl;
  10. }
  11.  
  12.  
  13. getSlide(deck: string, slide: string): Observable<string> {
  14.  
  15. const headers: HttpHeaders = new HttpHeaders({'Accept': 'text/html'});
  16. const thisUrl: string = this.requestUrl + '/' + deck + '/' + slide;
  17.  
  18. return this.http.get<string>(thisUrl, { headers: headers });
  19. }
  20. }
  21.  
  22. export class SlidePreviewComponent implements OnInit {
  23.  
  24. @Input() slide: string; /* Identifier for the slide */
  25. @Input() deck: string;
  26. slideHtml: string;
  27.  
  28.  
  29. constructor(private slideService: SlidesService) {
  30.  
  31. }
  32.  
  33. ngOnInit(): void {
  34. this.slideService.getSlide(this.deck, this.slide)
  35. .subscribe(html => this.setSlideHtml(html) );
  36. }
  37.  
  38. setSlideHtml(html: string) {
  39. this.slideHtml = html;
  40. console.log(html);
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement