Skip to content

Commit

Permalink
removed img viewchild
Browse files Browse the repository at this point in the history
  • Loading branch information
JayChase committed Jan 31, 2020
1 parent f3fed17 commit b0237de
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
17 changes: 9 additions & 8 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "demo:build"
"browserTarget": "demo:build",
"sourceMap": {
"scripts": true,
"styles": true,
"vendor": true
}
},
"configurations": {
"production": {
Expand Down Expand Up @@ -108,9 +113,7 @@
"projects/demo/tsconfig.spec.json",
"projects/demo/e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
"exclude": ["**/node_modules/**"]
}
},
"e2e": {
Expand Down Expand Up @@ -178,13 +181,11 @@
"projects/ngx-picture/tsconfig.lib.json",
"projects/ngx-picture/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
"exclude": ["**/node_modules/**"]
}
}
}
}
},
"defaultProject": "demo"
}
}
10 changes: 9 additions & 1 deletion projects/demo/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ <h2 class="mat-h2">ngx picture</h2>
alt="test"
[lazyLoad]="true"
#picture
></ngx-picture>
>
<ng-template #imgTemplate let-imageData>
<img
class="custom-template"
[src]="imageData.src"
[alt]="imageData.alt"
/>
</ng-template>
</ngx-picture>
<p class="mat-body-1">{{ pictureDetails$ | async }}</p>
</mat-card>
8 changes: 4 additions & 4 deletions projects/ngx-picture/src/lib/picture/picture.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import {
Optional,
Output,
PLATFORM_ID,
TemplateRef,
ViewChild
TemplateRef
} from '@angular/core';
import { WINDOW } from 'ngx-window-token';
import { NgxPictureConfig } from '../ngx-picture-config';
Expand All @@ -39,8 +38,9 @@ export type ImageFormat =
changeDetection: ChangeDetectionStrategy.OnPush
})
export class PictureComponent implements OnInit, AfterViewInit {
@ViewChild('img', { static: false }) img: ElementRef<HTMLImageElement>;
@ContentChild('imgTemplate', { static: false }) imgTemplate: TemplateRef<any>;
@ContentChild('imgTemplate', { static: false }) imgTemplate: TemplateRef<
HTMLImageElement
>;
@Input() src: string;
@Input() imageFormats = this.ngxPictureConfig.imageFormats;
@Input() breakpoints = this.ngxPictureConfig.breakpoints;
Expand Down

0 comments on commit b0237de

Please sign in to comment.