浏览代码

🐛 fix assets path

jmacura 3 年之前
父节点
当前提交
c3b1b491e3
共有 3 个文件被更改,包括 5 次插入1 次删除
  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
       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):
       (notably, the version of the Rural Attractiveness Index used here consists of only 4 instead of 6 sub-indices):
       <figure>
       <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>
         <figcaption>Composition of the Rural Attractiveness Index used in the Rural Attractiveness Explorer</figcaption>
       </figure>
       </figure>
     </p>
     </p>

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

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

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

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