Reading Input Text - ldco2016/microurb_web_framework GitHub Wiki

I am supposed to have a text input that shows a placeholder of the current user details name. I want to have the ability to type in a new name and then click the update name button. I will add that functionality.

I definitely have to ensure that I have an input and a button and that I have some click event handler on the button because thats what I really care about, I want to know when the button gets clicked.

import { User } from "../models/User";

export class UserForm {
  constructor(public parent: Element, public model: User) {
    this.bindModel();
  }

  bindModel(): void {
    this.model.on("change", () => {
      this.render();
    });
  }

  eventsMap(): { [key: string]: () => void } {
    return {
      "click:.set-age": this.onSetAgeClick,
      "click:.set-name": this.onSetNameClick,
    };
  }

  onSetNameClick = (): void => {};