title: Ionic 3 - Sending data to service from component
body: <p>I am trying to send an object from my component which is from the input of the user to the service I have.</p>
  <p>This is my code..</p>
  <blockquote>
  <p>Sample.html</p>
  </blockquote>
  <pre class="lang-html prettyprint-override"><code>&lt;ion-item&gt;
      &lt;ion-label color=&quot;primary&quot;&gt;Subject&lt;/ion-label&gt;
      &lt;ion-select [(ngModel)]=&quot;attendanceSet.subject&quot;&gt;
          &lt;ion-option *ngFor=&quot;let subject of subjects&quot; [value]=&quot;subject.title&quot;&gt;{{subject.title}}&lt;/ion-option&gt;
      &lt;/ion-select&gt;
  &lt;/ion-item&gt;
  &lt;ion-item&gt;
      &lt;ion-label color=&quot;primary&quot;&gt;Date&lt;/ion-label&gt;
      &lt;ion-datetime [(ngModel)]=&quot;attendanceSet.date&quot; displayFormat=&quot;DDD MMM DD&quot; pickerFormat=&quot;YYYY MM DD&quot;&gt;&lt;/ion-datetime&gt;
  &lt;/ion-item&gt;
  
  &lt;button ion-button block padding (click)=&quot;proceed(attendanceSet)&quot;&gt;Proceed&lt;/button&gt;
  </code></pre>
  <blockquote>
  <p>Sample.ts</p>
  </blockquote>
  <pre class="lang-js prettyprint-override"><code>public attendanceSet = {}
  
  proceed(attendanceSet) {
      this.navCtrl.push(CheckAttendancePage, {
          setData: attendanceSet
      });
  }
  </code></pre>
  <blockquote>
  <p>Service</p>
  </blockquote>
  <pre class="lang-js prettyprint-override"><code>private attendanceListRef: AngularFireList&lt;Attendance&gt;
  
  public setAttendance = {}
  
  constructor(private db: AngularFireDatabase, private events: Events, public navParams: NavParams, private method: CheckAttendancePage){
  
      this.attendanceListRef = this.db.list&lt;Attendance&gt;('attendance/')
  
  }
  
  addAttendance(attendance: Attendance) {
      return this.attendanceListRef.push(attendance)
  }
  </code></pre>
  <p>What I'm trying to do is getting data from the sample.html which I will later use to define the path of the &quot;attendanceListRef&quot; like this &quot;attendance/subject/date&quot;</p>
  <p>Is there any proper or alternative way to do this? <strong>Thanks!</strong></p>