home
  • Blog
1.12
  • Getting Started
  • Concepts
  • The Object Model
  • Application
  • Templates
  • Routing
  • Components
  • Controllers
  • Models
  • Views
  • Enumerables
  • Testing
  • Configuring Ember.js
  • Ember Inspector
  • Cookbook
    • Introduction
    • Contributing
    • User Interface and Interaction
    • Event Handling & Data Binding
    • Helpers & Components
    • Working with Objects
      • Introduction
      • Incrementing Or Decrementing A Property
      • Setting Multiple Properties At Once
      • Continuous Redrawing of Views
  • Understanding Ember.js
  • Contributing to Ember.js
Old Guides - You are viewing the guides for Ember v1.12.0.
Go to v5.0.0

Incrementing Or Decrementing A Property

Edit pencil

Problem

You want to increment or decrement a property.

Solution

Use the incrementProperty or decrementProperty methods of Ember.Object.

To increment:

person.incrementProperty('age');

To decrement:

person.decrementProperty('age');

Discussion

You can optionally specify a value to increment or decrement by:

person.incrementProperty('age', 10);
left arrow
Introduction
Setting Multiple Properties At Once
right arrow
On this page

  • Problem
  • Solution
  • Discussion
Team Sponsors Security Legal Branding Community Guidelines
Twitter GitHub Discord Mastodon

If you want help you can contact us by email, open an issue, or get realtime help by joining the Ember Discord.

© Copyright 2023 - Tilde Inc.
Ember.js is free, open source and always will be.


Ember is generously supported by
blue