Function

Module: @ember/object
dependentKey
String
value
Number
returns
ComputedProperty
computed property which returns true if the original value for property is less or equal than given value.

A computed property that returns true if the provided dependent property is less than or equal to the provided value.

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { set } from '@ember/object';
import { lte } from '@ember/object/computed';

class Hamster {
  @lte('numBananas', 3) needsMoreBananas;
}

let hamster = new Hamster();

hamster.needsMoreBananas; // true

set(hamster, 'numBananas', 5);
hamster.needsMoreBananas; // false

set(hamster, 'numBananas', 3);
hamster.needsMoreBananas; // true

Classic Class Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import EmberObject, { set } from '@ember/object';
import { lte } from '@ember/object/computed';

let Hamster = EmberObject.extend({
  needsMoreBananas: lte('numBananas', 3)
});

let hamster = Hamster.create();

hamster.needsMoreBananas; // true

set(hamster, 'numBananas', 5);
hamster.needsMoreBananas; // false

set(hamster, 'numBananas', 3);
hamster.needsMoreBananas; // true