Jelajahi Sumber

🐛 fix routing when base-href is not /

resolves #1
jmacura 3 tahun lalu
induk
melakukan
729e3c143f
3 mengubah file dengan 3 tambahan dan 3 penghapusan
  1. 0 1
      src/app/app.component.ts
  2. 2 1
      src/app/app.module.ts
  3. 1 1
      src/index.html

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

@@ -8,7 +8,6 @@ import {SdmDihService} from './sdm-dih.service';
   styleUrls: ['./app.component.scss'],
 })
 export class AppComponent {
-  offcanvasRef;
   assetsPath = window.location.hostname.includes('localhost')
     ? '../assets/'
     : './assets/';

+ 2 - 1
src/app/app.module.ts

@@ -1,5 +1,6 @@
 import {BrowserModule} from '@angular/platform-browser';
 import {FormsModule} from '@angular/forms';
+import {HashLocationStrategy, LocationStrategy} from '@angular/common';
 import {NgModule} from '@angular/core';
 
 import {AppComponent} from './app.component';
@@ -41,7 +42,7 @@ import {TextMiningComponent} from './pages/text-mining/text-mining.component';
     DotsModule,
     MapModule,
   ],
-  providers: [],
+  providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}],
   bootstrap: [AppComponent],
 })
 export class AppModule {}

+ 1 - 1
src/index.html

@@ -5,7 +5,7 @@
   <meta charset="utf-8">
   <title>Rural attractiveness explorer</title>
   <base href="./">
-  <script>document.write('<base href="' + document.location + '"/>');</script>
+  <!--script>document.write('<base href="' + document.location + '"/>');</script-->
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="icon" type="image/x-icon" href="favicon.ico">
 </head>