Skip to content
This repository was archived by the owner on Dec 3, 2020. It is now read-only.
 
 

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

bindStyle-ember-helper

A very simple handlebar helper for ember.js which allow you to bind style properties in your templates.

Requirements

Ember.js

Usage


{{bindStyle}} is based on ember {{bindAttr}} and works pretty much the same way.

Imagine a view that contains the width of a bar in your bar-chart.

App.MyBarChart = Ember.View.extend({
	barWidth: 200
});

In your handlebars template you will then do

<div class="bar" {{bindStyle width="barWidth" width-unit="px"}}></div> 

You must define the unit for the value to be used. There are 2 ways to define units.

Global unit

<div class="bar" {{bindStyle unit="px" width="barWidth" height="barHeight"}}></div> 

Specific unit

<div class="bar" {{bindStyle width="barWidth" width-unit="px" height="barHeight" height-unit="%"}}></div> 

If you define a global unit and specific units. The specific unit take precedence over the global when defined.

That's it

About

An ember.js extension to easily bind css style attributes

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages