Skip to content

Commit

Permalink
Add Angular2 Directive example (sindresorhus#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
leocaseiro authored and sindresorhus committed Sep 13, 2016
1 parent dcdfb8c commit b301bdf
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,28 @@ You can use the [Angular.js binding](https://github.com/hrajchert/angular-screen
</div>
```

#### Fullscreen the page with Angular 2

```typescript
import { Directive, HostListener } from '@angular/core';
const screenfull = require('screenfull');

@Directive({
selector: '[toggleFullscreen]'
})
export class ToggleFullscreenDirective {
@HostListener('click') onClick() {
if (screenfull.enabled) {
screenfull.toggle();
}
}
}
```

```html
<button toggleFullscreen>Toggle fullscreen<button>
```

### Methods

#### .request()
Expand Down

0 comments on commit b301bdf

Please sign in to comment.