jeudi 5 mai 2016

How can I observe a property change from one value to another in Ember?

I have created a method in Ember that is triggered when a new Itinerary is created:

checkIfNewItinerary: function () {

    if (!this.get("itinerary.isNew")) {
        //Do something
    }

}.observes("itinerary.isNew")

The trouble is that if the Itinerary has already been created, this observer is triggered every time the page loads. Instead, I would like "Do something" to be triggered only when this.get("itinerary.isNew") changes in value (so that it does not trigger on page load). OR, I simply need a way of disabling the observer at page load.

What are my options here?

EDIT: I've been looking at beforeObservers, but it appears that those are deprectaed




Aucun commentaire:

Enregistrer un commentaire