Sfoglia il codice sorgente

🐛 fix assets path

jmacura 3 anni fa
parent
commit
c3b1b491e3
3 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 1 1
      src/app/app.component.html
  2. 3 0
      src/app/app.component.ts
  3. 1 0
      src/app/sdm-dih.service.ts

+ 1 - 1
src/app/app.component.html

@@ -103,7 +103,7 @@ Link to the “The Policy Options Explorer” (pages of Runar and Antoni, or sep
       this purpose, we adapted the Rural Attractiveness Index to fit with the Policy Options Explorer as follows
       (notably, the version of the Rural Attractiveness Index used here consists of only 4 instead of 6 sub-indices):
       <figure>
-        <img src="../assets/rai-composition.png" class="img-fluid">
+        <img src="{{assetsPath}}rai-composition.png" class="img-fluid">
         <figcaption>Composition of the Rural Attractiveness Index used in the Rural Attractiveness Explorer</figcaption>
       </figure>
     </p>

+ 3 - 0
src/app/app.component.ts

@@ -11,6 +11,9 @@ import {SdmDihService} from './sdm-dih.service';
 })
 export class AppComponent {
   offcanvasRef;
+  assetsPath = window.location.hostname.includes('localhost')
+    ? '../assets/'
+    : './assets/';
 
   constructor(
     private offcanvasService: NgbOffcanvas,

+ 1 - 0
src/app/sdm-dih.service.ts

@@ -1,6 +1,7 @@
 import {BehaviorSubject} from 'rxjs';
 import {HttpClient} from '@angular/common/http';
 import {Injectable} from '@angular/core';
+
 import {csv} from 'd3';
 
 import vars2facts from '../assets/data/variables2factors.json';