Skip to content

Commit

Permalink
simplified directive to "src-fallback"
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimDez committed Jun 7, 2016
1 parent 64927db commit bacef74
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dist/src/ng2-img-fallback.directive.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/ng2-img-fallback.directive.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ <h3>Broken image</h3>
</div>
<div>
<h3>Broken image with broken fallback</h3>
<img src="not-working_image" alt="not working image with not working fallback" ng2-img-fallback="{{ brokenPlaceholder }}">
<img src="not-working_image" alt="not working image with not working fallback" src-fallback="{{ brokenPlaceholder }}">
</div>
<div>
<h3>Broken image with working fallback</h3>
<img src="not-working_image" alt="not working image with wirking fallback" ng2-img-fallback="{{ workingPlaceholder }}">
<img src="not-working_image" alt="not working image with wirking fallback" src-fallback="{{ workingPlaceholder }}">
</div>
</section>

Expand Down
2 changes: 1 addition & 1 deletion src/ng2-img-fallback.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Ng2ImgFallback } from './ng2-img-fallback.directive';

@Component({
selector: 'test-component',
template: `<div ng2-img-fallback></div>`
template: `<div src-fallback></div>`
})
class TestComponent {}

Expand Down
4 changes: 2 additions & 2 deletions src/ng2-img-fallback.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { Directive, ElementRef, Input } from '@angular/core';

@Directive({
selector: '[ng2-img-fallback]'
selector: '[src-fallback]'
})
export class Ng2ImgFallback {

@Input('ng2-img-fallback') imgSrc: string;
@Input('src-fallback') imgSrc: string;
private el:HTMLElement;
private isApplied: boolean = false;
private EVENT_TYPE = 'error';
Expand Down

0 comments on commit bacef74

Please sign in to comment.