0

maybe its a bug or maybe I'm just stupid idk

I'm still new and I've just started learning angular but firebase tutorial lead me here and I just need a router so I implemented this

here is the problem when I edit my HTML file in ./app/home/home.template.html it doesn't hot reload the webpage even I shift reload the browser it only works if I F5 or refresh the whole IDE, and its a pain in the ass because every time I have minor changes that I don't know the outcome I need to F5 the IDE and the history will be reset

I've tried just using template: and it works fine

I've tried to do this in the app.component.ts and it worked fine

this is my files for my website

File directory

this is the app.component.ts

    import { Component, enableProdMode } from "@angular/core";
@Component({
  selector: "my-app",
  templateUrl: "./app.template",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {}
document.head.append('<base href="/"/>');
var isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;
if (isDarkMode) {
  document.body.className = "dark";
}

this is the home.component.ts

import { Component } from "@angular/core";

@Component({
  selector: "home",
  templateUrl: "/home.template",
  styleUrls: ["./style.css"]
})
export class HomeViewComponent {}

this is the top navigation code in HTML ./app.template.html

<body>
  <div>
    <div class="topnav">
      <img
            class="companylogo"
            src=""
          />
      <a routerLinkActive="active" routerLink="/home">Home</a>

      <a routerLinkActive="active" routerLink="/projects">Projects</a>

      <a routerLinkActive="active" routerLink="/contact">Contact</a>
    </div>
    <router-outlet></router-outlet>
  </div>
</body>

as you can see in the next pic, it doesn't update Problem

if there's something lacking of an explanation, feel free to ask! thank you!!

DEEz
  • 99
  • 1
  • 1
  • 10
  • Can you share that stackblitz code link? – hbamithkumara Mar 30 '21 at 19:26
  • @hbamithkumara do you really guys need it? , it contains personal data and my firebase doesn't have firebase security yet – DEEz Mar 30 '21 at 19:36
  • @hbamithkumara here you go!, i removed all firebase storage URL's to prevent DDOSing my storage and ended up billing me, https://stackblitz.com/edit/deez-portfolio – DEEz Mar 30 '21 at 19:56
  • Try to remove document object code and check . Not sure about it though . – Aditya Yada Mar 30 '21 at 20:36
  • @AdityaYada i tried removing the object code `document.body.className` and `document.head.append` in the `app.component.cs` and it still doesn't work – DEEz Mar 31 '21 at 15:36
  • Go to settings . change Reload mechanism from page reload to hot reload . – Aditya Yada Mar 31 '21 at 17:10
  • @AdityaYada it dosnt work, tried hot reload and page reload, hot reload trigger to keystroke,edit and save before – DEEz Apr 06 '21 at 14:30
  • anyways if it cant be solved im just ganna use the `app.component,ts` for editing HTML for hot reload then when I'm done, just move it back – DEEz Apr 06 '21 at 14:34

1 Answers1

0

apparently connecting your project to Github Fixes the problem!! how weird...

DEEz
  • 99
  • 1
  • 1
  • 10