title: Go back to previous page in Angular 4
body: <p>I want to have back-to-the-previous page. </p>
  
  <p>Previous Page: job.html
  Current Page: jobDetail.html</p>
  
  <p>As per instructions, I have added <code>import { Location } from '@angular/common';</code> to the <code>jobDetail.component.ts</code> file at the top followed by</p>
  
  <pre><code>export class MyDetailComponent implements OnInit {
  constructor(private location: Location) {}
      ngOnInit() {
          this.location.subscribe(x =&gt; console.log(x));
      }
  }
  </code></pre>
  
  <p>I have a html code in jobDetail.html but don't know how to proceed further. How do I add a previous button correctly. There's no easy tutorial for newbies like me.</p>
  
  <pre><code>&lt;a routerLink=""&gt;Back&lt;/a&gt;
  </code></pre>