Skip to main content
changed docs URL to the new place (the previous one was redirecting here)
Source Link

In the final version of Angular 2.x / 4.x - here's the docs https://angular.io/docs/ts/latest/api/common/index/Location-class.htmlhttps://angular.io/api/common/Location

/* typescript */

import { Location } from '@angular/common';
// import stuff here

@Component({
// declare component here
})
export class MyComponent {
  
  // inject location into component constructor
  constructor(private location: Location) { }

  cancel() {
    this.location.back(); // <-- go back to previous location on cancel
  }
}

In the final version of Angular 2.x / 4.x - here's the docs https://angular.io/docs/ts/latest/api/common/index/Location-class.html

/* typescript */

import { Location } from '@angular/common';
// import stuff here

@Component({
// declare component here
})
export class MyComponent {
  
  // inject location into component constructor
  constructor(private location: Location) { }

  cancel() {
    this.location.back(); // <-- go back to previous location on cancel
  }
}

In the final version of Angular 2.x / 4.x - here's the docs https://angular.io/api/common/Location

/* typescript */

import { Location } from '@angular/common';
// import stuff here

@Component({
// declare component here
})
export class MyComponent {
  
  // inject location into component constructor
  constructor(private location: Location) { }

  cancel() {
    this.location.back(); // <-- go back to previous location on cancel
  }
}
deleted 6 characters in body
Source Link
Hinrich
  • 14.1k
  • 8
  • 48
  • 67

In the final version of Angular 2.x / 4.x: - here's the docs https://angular.io/docs/ts/latest/api/common/index/Location-class.html

/* typescript */

import { Location } from '@angular/common';
// moreimport importsstuff here...

@Component({
  // component'sdeclare declarationscomponent here
})
export class MyComponent {
  
  // inject location into component constructor
  constructor(private location: Location) { } // inject Location into class constructor

  cancel() {
    this.location.back(); // <-- go back to previous location on cancel
  }
}

Have a look in the docs https://angular.io/docs/ts/latest/api/common/index/Location-class.html

In the final version of Angular 2.x / 4.x:

/* typescript */

import { Location } from '@angular/common';
// more imports here...

@Component({
  // component's declarations here
})
export class MyComponent {

  constructor(private location: Location) { } // inject Location into class constructor

  cancel() {
    this.location.back(); // <-- go back to previous location on cancel
  }
}

Have a look in the docs https://angular.io/docs/ts/latest/api/common/index/Location-class.html

In the final version of Angular 2.x / 4.x - here's the docs https://angular.io/docs/ts/latest/api/common/index/Location-class.html

/* typescript */

import { Location } from '@angular/common';
// import stuff here

@Component({
// declare component here
})
export class MyComponent {
  
  // inject location into component constructor
  constructor(private location: Location) { }

  cancel() {
    this.location.back(); // <-- go back to previous location on cancel
  }
}
hint for ts syntaxhighlighting
Source Link
Hinrich
  • 14.1k
  • 8
  • 48
  • 67

In the final version of Angular 2.x / 4.x:

/* typescript */

import { Location } from '@angular/common';
// more imports here...

@Component({
  // component's declarations here
})
export class MyComponent {

  constructor(private location: Location) { } // inject Location into class constructor

  cancel() {
    this.location.back(); // <-- go back to previous location on cancel
  }
}

Have a look in the docs https://angular.io/docs/ts/latest/api/common/index/Location-class.html

In the final version of Angular 2.x / 4.x:

/* typescript */

import { Location } from '@angular/common';
// more imports here...

@Component({
  // component's declarations here
})
export class MyComponent {

  constructor(private location: Location) { } // inject Location into class constructor

  cancel() {
    this.location.back(); // <-- go back to previous location on cancel
  }
}

Have a look in the docs https://angular.io/docs/ts/latest/api/common/index/Location-class.html

In the final version of Angular 2.x / 4.x:

/* typescript */

import { Location } from '@angular/common';
// more imports here...

@Component({
  // component's declarations here
})
export class MyComponent {

  constructor(private location: Location) { } // inject Location into class constructor

  cancel() {
    this.location.back(); // <-- go back to previous location on cancel
  }
}

Have a look in the docs https://angular.io/docs/ts/latest/api/common/index/Location-class.html

added 6 characters in body
Source Link
Hinrich
  • 14.1k
  • 8
  • 48
  • 67
Loading
edited body
Source Link
Hinrich
  • 14.1k
  • 8
  • 48
  • 67
Loading
adds language hint
Source Link
Hinrich
  • 14.1k
  • 8
  • 48
  • 67
Loading
Source Link
Hinrich
  • 14.1k
  • 8
  • 48
  • 67
Loading