Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Latest commit

 

History

History
26 lines (21 loc) · 822 Bytes

introduction.md

File metadata and controls

26 lines (21 loc) · 822 Bytes

View Introduction

Views are a way to divide your application into pieces. Often you will find out that views are most appropriate to represent entire pages in your application and Nested Views to be logic separation in your current view.

Let's take a look at a simple example.

<script>
  var App = blocks.Application();

  App.View('HelloView', {
    helloMessage: 'Hello from View',

    // called when the view is created
    // do any initialization work here
    init: function () {
      this.description = 'I am powerful';
    }
  });
</script>
<div data-query="view(HelloView)">
  <h1>{{helloMessage}}</h1>
  <p>{{description}}</p>
</div>

Views are most powerful when combined with Models and Collections.**