Closed KeithGillette closed 7 years ago
Thanks! 👍
@KeithGillette this feature will be added with #57. You will be able to do this:
<inline-editor #editor [(ngModel)]="title" type="text" [saveOnEnter]="true"></inline-editor>
or more complex/low level:
import { Component } from '@angular/core';
import { InlineEditorComponent, InlineEvent } from 'ng2-inline-editor';
@Component({
selector: 'app-root',
templateUrl: '<inline-editor #editor [(ngModel)]="title" type="text" (onEnter)="save($event, editor)"></inline-editor>',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'hi';
save(event: InlineEvent, editor: InlineEditorComponent) {
// InlineEvent is a wrapper of {event: NativeEvent, state: State of input when it was saved}
this.title = event.state.value;
editor.saveAndClose({
state: {
value: this.title,
}
});
}
}
👍
This should be fixed in the last version (0.2.0-alpha.0
). With the change of name, you should do an npm i @qontu/ngx-inline-editor
and update your imports 👍
It would be great if the component API allowed access to the "save" and "cancel" button methods generically in such a way as we could bind arbitrary events to trigger them. For example: