Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

Commit

Permalink
feat: add attribute selector
Browse files Browse the repository at this point in the history
  • Loading branch information
smnbbrv committed Dec 18, 2018
1 parent 2575d80 commit f14b3c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,24 @@ imports: [
],
```

Finally use `plyr` in your components:
Finally use `plyr` in your components as attribute:

```html
<div plyr style="width: 640px;" plyrTitle="Video 1" [plyrSources]="videoSources" (plyrPlay)="played($event)"></div>

<button (click)="play()">Play</button>
```

or tag:

```html
<plyr style="display:block; width: 640px;" plyrTitle="Video 1" [plyrSources]="videoSources" (plyrPlay)="played($event)"></plyr>

<button (click)="play()">Play</button>
```

and the component file would have

```ts
@ViewChild(PlyrComponent)
plyr: PlyrComponent;
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-plyr/src/lib/plyr/plyr.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BehaviorSubject, Observable } from 'rxjs';
import { filter, switchMap } from 'rxjs/operators';

@Component({
selector: 'plyr', // tslint:disable-line
selector: 'plyr, [plyr]', // tslint:disable-line
templateUrl: './plyr.component.html',
styleUrls: ['./plyr.component.css'],
exportAs: 'plyr'
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1>{{ title }}</h1>

<plyr style="display:block; width: 640px;" plyrTitle="Video 1" [plyrSources]="videoSources" (plyrPlay)="played($event)"></plyr>
<div plyr style="width: 640px;" plyrTitle="Video 1" [plyrSources]="videoSources" (plyrPlay)="played($event)"></div>

<button (click)="play()">Play</button>

0 comments on commit f14b3c9

Please sign in to comment.