Add and edit item form same ionic modal form

Hi, im using ionicModal to push items to an array, using ng-submit to push the object to this array, can somebody please post an example of how to use the same form for edit a clicked item in the list?

I can’t understand how to pass the list item instance to the form

$ionicModal.fromTemplateUrl('templates/add-item-modal.html', {  
    scope: $scope,
    animation: 'slide-in-up',
    focusFirstInput: true
  }).then(function (modal) {
    $scope.modal = modal;

    <h1 class="title">Aggiungi</h1>
  <ion-content class="padding">
  <form ng-submit="addItem()">
    <div class="list list-inset">
      <label class="item item-input">
        <input placeholder="Prodotto" ng-model="name" name="name" type="text">
      <button class="button button-block button-positive activated">

Did you ever got it resolved?

Hi, i managed it this way. create a function that accept an item as agrument and bind it to scope if exist( used a edit button) or create a new one (clicked on new) then open the modal

    $scope.openModal = function(item) {
      $scope.itemInForm = item || {
        important: false,
       completed: false

and in the form (inside the modal) i bind to itemInForm

<input ng-required="true" placeholder="Product" ng-model="" name="name" type="text">

on your edit button

<ion-option-button class="button-energized" ng-click="openModal(item)">

Thank you!!! her solution solved my problem too. :laughing: