Ember select making model dirty on init


#1

Having this select in my template makes my model dirty and triggers observer on init, why? I wanna be able to update my model on change but now my update function is triggered on init and i don’t wanna make a api call on every single item on init.

template:

{{#each booking in bookings itemController="booking"}}
  {{isDirty}} // this is true
  {{view "select" content=dateRange value=booking.playingOn optionValuePath="content.date" optionLabelPath="content.day"}}
{{/each}}

controller:

  // this is running on init and when you select something in the select drop down.
  updatePlayingOn: function(){
    console.log(this.get('currentState.stateName')); // logs root.loaded.updated.uncommitted 
  }.observes('playingOn')

As i have understood value=booking.playingOn updates the playingOn model attribute to the same value and making the model dirty.


#2

seems like ember select can’t handle javascript objects, in this case a Date object. Making my objects to strings solves the problem.