Skip to content

Lightweight mvc for basic data binding between a json object and the DOM

License

Notifications You must be signed in to change notification settings

rootgog/minimvc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniMVC

MiniMVC is a lightweight solution to bind javascript objects to DOM elements

Get Started

1. Include the module

import MVC from "https://unpkg.com/minimvc";

2. Initialise MiniMVC

let data = {
    header = "My first blog post"
}

let mvc = new MVC({data});

3. Edit the DOM

<h1 data-bind="header"></h1>
<p data-bind="paragraph">
  Lorem ipsum dolor sit, amet consectetur adipisicing elit. Pariatur rerum
  consectetur nemo accusantium, quos nisi fuga eius explicabo! Est qui commodi,
  doloribus fugiat in eveniet iste iure neque voluptatem vel.
</p>

Parameters

MiniMVC can accept two parameters

Parameter Description Default
data An Object that contains all of the data that is to be syncronised with the DOM MiniMVC.data = {}
bindAttribute The attribute that will be used in the HTML to identify it's data equivelent data-bind

TODO:

  • Support Nested data object

About

Lightweight mvc for basic data binding between a json object and the DOM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published