# j-ClBind

> The component reads an item with a linked data source. The component supports Tangular template inside the element (optional). As the value is stored in the {{ value.something }} variable.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 33e141ae2d66fc7e95b8a002d044972fd987ef16dc51d88b7c60be89b049b955
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

The component reads an item with a linked data source. The component supports Tangular template inside the element (optional). As the value is stored in the `{{ value.something }}` variable.


__Configuration__:

- `datasource {String}` or `dirsource {String}` __required__ a data-source
- `id {String}` a pair key (default: `id`)
- `nullable {Boolean}` renders `null` value (default: `true`)
- `exec {String}` executes `function(value, element)` method
- `bind {String}` binds a read value according to the defined path

Use it with `<ui-component name="clbind">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<ui-component name="clbind" path="form.typeid" config="datasource:#types;nullable:0;bind:form.type">
	<script type="text/html">
		<div>Value: {{ value.name }}</div>
	</script>
</ui-component>
<br />
<ui-bind path="!form.type" config="html:value.name"></ui-bind>

<script>
	DEF.cl.types = [{ id: 'totaljs', name: 'Total.js' }, { id: 'java', name: 'Java' }, { id: 'php', name: 'PHP' }, { id: '.net', name: '.NET' }];
	var form = {};
	form.typeid = 'totaljs';
</script>
```
