How to properly extend the IF attribute

This should be much simpler (untested code!)

import {customAttribute, autoinject} from 'aurelia-framework';

@customAttribute('naive-show')
@autoinject
export class NaiveShow {
	constructor(private element: Element) { }

	valueChanged(newValue: any): void {
		this.element.style.display = newValue ? 'block' : 'none';
	}
}
1 Like