All Projects → ken107 → databind-js

ken107 / databind-js

Licence: MIT license
A powerful and flexible MVC data binding library

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to databind-js

puremvc-swift-multicore-framework
PureMVC MultiCore Framework for Swift
Stars: ✭ 17 (+6.25%)
Mutual labels:  mvc, mvc-framework
velox
The minimal PHP micro-framework.
Stars: ✭ 55 (+243.75%)
Mutual labels:  mvc, mvc-framework
Cakephp
CakePHP: The Rapid Development Framework for PHP - Official Repository
Stars: ✭ 8,453 (+52731.25%)
Mutual labels:  mvc, mvc-framework
Saturn
Opinionated, web development framework for F# which implements the server-side, functional MVC pattern
Stars: ✭ 540 (+3275%)
Mutual labels:  mvc, mvc-framework
SmartMvc
深入解析SpringMVC核心原理:从手写简易版MVC框架开始(SmartMvc)
Stars: ✭ 66 (+312.5%)
Mutual labels:  mvc, mvc-framework
Actframework
An easy to use Java MVC server stack
Stars: ✭ 690 (+4212.5%)
Mutual labels:  mvc, mvc-framework
Slim Born
Slim Framework 3 and 4 skeleton application has authentication MVC construction.
Stars: ✭ 179 (+1018.75%)
Mutual labels:  mvc, mvc-framework
laminas-mvc
Laminas's event-driven MVC layer, including MVC Applications, Controllers, and Plugins
Stars: ✭ 90 (+462.5%)
Mutual labels:  mvc, mvc-framework
UMVC
UMVC - Model-View-Controller Generator built for Unity
Stars: ✭ 36 (+125%)
Mutual labels:  mvc, mvc-framework
djburger
Framework for safe and maintainable web-projects.
Stars: ✭ 75 (+368.75%)
Mutual labels:  mvc, mvc-framework
Koseven
Koseven a Kohana fork compatible with PHP7
Stars: ✭ 332 (+1975%)
Mutual labels:  mvc, mvc-framework
puremvc-delphi-standard-framework
A Delphi implementation of PureMVC (http://puremvc.org/)
Stars: ✭ 44 (+175%)
Mutual labels:  mvc, mvc-framework
miniPHP
A small, simple PHP MVC framework skeleton that encapsulates a lot of features surrounded with powerful security layers.
Stars: ✭ 147 (+818.75%)
Mutual labels:  mvc, mvc-framework
Famework
Famework is a simple to use PHP Framwork to easily create splendid but lightweight web applications.
Stars: ✭ 8 (-50%)
Mutual labels:  mvc, mvc-framework
blockbase
Lightweight MVC Framework for Node.js
Stars: ✭ 32 (+100%)
Mutual labels:  mvc, mvc-framework
Miniphp
A small, simple PHP MVC framework skeleton that encapsulates a lot of features surrounded with powerful security layers.
Stars: ✭ 144 (+800%)
Mutual labels:  mvc, mvc-framework
leafMVC
MVC "Framework" created from Leaf PHP Framework
Stars: ✭ 25 (+56.25%)
Mutual labels:  mvc, mvc-framework
Bingo-Framework
MVC framework for PHP
Stars: ✭ 15 (-6.25%)
Mutual labels:  mvc, mvc-framework
libgitlmvc
C++ MVC framework for Qt
Stars: ✭ 73 (+356.25%)
Mutual labels:  mvc, mvc-framework
simple-mvc
Simple push & pull MVC framework to realize a test-driven experience.
Stars: ✭ 24 (+50%)
Mutual labels:  mvc, mvc-framework

What's This?

Data binding allows you to detect changes to your data and react by updating the DOM.

Installation

First add databind.js to your page.

<script src="http://cdn.rawgit.com/ken107/databind-js/master/databind.js"></script>

Or bower install databinder.

Detecting Changes To Your Data

Your data is whatever this points to, which is by the default the window object. Say your window object has the following property:

window.blog = {
	name: "My blog",
	entries: [
		{ title: "...", text: "...", isPublished: true },
		{ title: "...", text: "...", isPublished: false }
	]
}

To bind to the text of the first blog entry, for example, use the binding expression #blog.entries[0].text.

Updating the DOM

Set the text content of an element

<h2>{{#blog.entries[0].title}}</h2>
<p>{{#blog.entries[0].text}}</p>

Hide/show an element

<div bind-statement-1="thisElem.style.display = #blog.entries[0].isPublished ? 'block' : 'none'">
	{{#blog.entries[0].text}}
</div>

Change an image

<img bind-statement-1="thisElem.src = #blog.entries[0].isPublished ? 'checked.png' : 'unchecked.png'" />

Toggle a CSS class (using jQuery)

<li bind-statement-1="$(thisElem).toggleClass('published', #blog.entries[0].isPublished)">
	{{#blog.entries[0].title}}
</li>

Call a function

<div bind-statement-1="doSomething(#blog.entries[0].text)"></div>

Say you want to repeat an element a number of times

<div bind-repeater-i="#blog.entries.length">{{#blog.entries[#i].text}}</div>

Set the value of an text box

<input type="text" bind-statement-1="thisElem.value = #blog.entries[0].title" />

Et cetera.

The bind-statement specifies a JavaScript statement that should be executed every time your data changes. It is one of just 6 binding directives that together let you write responsive apps of any complexity. They're no less capable than Angular or React.

Proceed to the documentation for the full list of binding directives.

Example

http://jsfiddle.net/wcoczs50/4/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].