Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed broken link

...

Code Block
function addEntry() {
    // create a new model instance based on user input
    var entry = Alloy.createModel('journal', {
        title : $.title.value,
        text: $.text.value,
        mood: getMood($.mood),
        dateCreated: moment().format('YYYYMMDDHHmmss')
    });
    // Add new model to the collection, use silent=true
    // so that a "change" event is not fired and the
    // UI is re-rendered.
    journal.add(entry, {silent:true});
    // Save the entry to persistence, which will re-render
    // the UI based on the binding.
    entry.save();
    closeWindow();
}

See Also