Skip to content

Instantly share code, notes, and snippets.

@geeksilva97
Created June 29, 2019 00:46
Show Gist options
  • Save geeksilva97/d67d5a3ccf3b26844486751eb3c61930 to your computer and use it in GitHub Desktop.
Save geeksilva97/d67d5a3ccf3b26844486751eb3c61930 to your computer and use it in GitHub Desktop.
SPA on GitHub Pages
import { Component } from '@angular/core';
import { Router } from '@angular/router';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.sass']
})
export class AppComponent {
title = 'my-spa';
constructor(private router: Router) {
let path = localStorage.getItem('path');
if(path) {
localStorage.removeItem('path');
this.router.navigate([path]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment