This repository has been archived by the owner on Apr 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #39: Backbutton for Electron and Cordova
- Loading branch information
Manuel Rauber
committed
Feb 26, 2016
1 parent
919b0f0
commit 7d3cd2c
Showing
5 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {Directive, HostListener} from 'angular2/core'; | ||
import {PlatformInformationService} from '../services/platform.information.service'; | ||
import {Location} from 'angular2/router'; | ||
@Directive({ | ||
selector: '[back-button]', | ||
host: { | ||
'[attr.hidden]': 'isHidden' | ||
} | ||
}) | ||
export class BackButtonDirective { | ||
public isHidden: boolean = true; | ||
|
||
constructor(private _platformInformationService: PlatformInformationService, | ||
private _location: Location) { | ||
this.setHidden(); | ||
} | ||
|
||
private setHidden(): void { | ||
this.isHidden = this._platformInformationService.isWeb; | ||
} | ||
|
||
@HostListener('click') | ||
public onClick() { | ||
this._location.back(); | ||
} | ||
} |
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
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