Created
June 29, 2019 00:46
-
-
Save geeksilva97/d67d5a3ccf3b26844486751eb3c61930 to your computer and use it in GitHub Desktop.
SPA on GitHub Pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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