1.0.2 • Published 6 years ago

ember-go v1.0.2

Weekly downloads
9
License
MIT
Repository
-
Last release
6 years ago

ember-go

An Ember addon to avoid boilerplate in ember-app

Version : 1.0.1

Installation

  • npm install ember-go @ember-go-version

Helpers

AND :

Returns true if all the conditions met. If given variable is array or string non-empty value will be considered as true.

example :

{{if (and true false true)}}

or in compoentnets

{{input disabled=(and ONE TWO THREE)}}

OR :

Returns first true value in given parameters list.

example :

{{if (or true false true)}} <!--returns true-->

{{if (or false 1 false)}} <!--returns 1-->


or in compoentnets

{{input value=(or ONE TWO THREE)}}

<!-- ONE = false
TWO = true
THREE = false
returns true -->

NOT :

Returns true if parameter is an empty array or an empty string or false or null or undefined or zero.

example :

(not DEMO)

EQUAL :

Check whether two objects are equal

(eq object1 object2) uses === to compare objects.

(eq object1 object2 true) - uses == to compare objects.

NOT EQUAL :

Check whether two objects are not equal

(neq object1 object2) uses === to compare objects.

(neq object1 object2 true) - uses == to compare objects.

Comparision helpers :

lt - Less than

gt - Greater than

gte - Greater than or equal

lte - Less than or equal

Visiblity helpers :

example :

<div class="{{show conditionOne conditionTwo}}"></div> <!--shows if all the values is true , by default all criteria is used-->
<div class="{{show conditionOne conditionTwo condition='any'}}"></div> <!--shows if any conditions is true-->
<div class="{{hide conditionOne conditionTwo)}}"></div> <!--hides if all value is true-->
<div class="{{hide conditionOne conditionTwo condition='any')}}"></div> <!--hides if any value is true-->

Note : Needs to add these css rules in your project (bootstrap already has these css rules).

.hide{
     display: none!important;
}

GLOBAL DATA :

Using global data you can store any key value pair accross components,route,controllers.

example :

In controller,

export default Ember.Controller.extend({
     actions: {
		demo() {
			console.log(this.get('globalData').getData('accountID')); //prints null
               console.log(this.get('globalData').getData('accountID','default value')); //prints default value     
               this.get('globalData').setData('accountID',true);
			console.log(this.get('globalData').getData('accountID','default value')); //prints true
		}
	}
});

Global data is injected to all the objects. Thus using this.get('globalData') will return global data

For more information on using ember-go, visit https://gokuldroid.github.io/.

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago