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

An ember.js extension to easily bind css style attributes

Notifications You must be signed in to change notification settings

Handfeger/bindstyle-ember-helper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%