import Component from '@ember/component'; export default Component.extend({ classNames: ['my-component'], click() { alert('You clicked me!'); } });
import Component from '@ember/component'; export default Component.extend({ didInsertElement() { this.$('.my-input').focus(); } });This example creates a component that automatically focuses on a text input element with the class name 'my-input' when it is inserted into the DOM. Both examples use the '@ember/component' library.