Hi there,
I’m having an issue where my “ion-img” DOM element isn’t found by the ng2 selector in a directive. When I use a standard “img” tag the selector finds the DOM element. Anyone know why? Example trying to use “ion-img” is below:
ImageDirective.ts
import {Component, Directive, Output, EventEmitter, Input, SimpleChange, ElementRef, HostListener} from '@angular/core'
@Directive({
selector: 'ion-img[default]',
host: {
'(error)':'updateUrl()',
'[src]':'src'
}
})
export class DefaultImage {
@Input() src:string;
@Input() default:string;
updateUrl() {
this.src = this.default;
}
}
myTemplate.html
<ion-img class="max-height-80" src="{{ diaryEntry.thumbnailUrl }}" default="{{ diaryEntry.url }}"></ion-img>