16: Hydrate Number of Remaining

Show number of remaining todos in footer.

  1. Define remaining computed to controller element by x-computed directive.
  2. Hydrate remaining to <strong> in footer by x-text directive. And then, remove confirm text in <strong> (3).

<body>
  <section class="todoapp"



    x-computed="{
      get remaining () {
        return this.todos.filter(todo => !todo.completed).length
      }
    }"
  ::>


    <footer class="footer">
      <span class="todo-count">
        <strong x-text="remaining">3</strong> items left
      </span>

    </footer>
  </section>
</body>
</html>