title: How to call a function of component from template of another component in ionic 2
body: <p>I want to call a function of component from template of another component in </p>
  
  <p>ionic 2.I get a dashboard in in my app <strong>dashboard.html</strong> using home.ts </p>
  
  <p>component.</p>
  
  <pre><code>&lt;ion-content&gt; 
  &lt;div class="dashboardSection"&gt;
  
              &lt;a href="" (click)="fetchAllClass()"&gt;
                  &lt;div class="header padding text-center classes common"&gt;
                      &lt;img src="assets/images/icos_15.png" alt="Your logo here"  width="50%" height="auto"/&gt;
                      &lt;p class="Sectiontitle"&gt;STUDENTS&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/a&gt;&lt;/div&gt;
  &lt;/ion-content&gt;
  </code></pre>
  
  <p>this is showing with the help of home.ts </p>
  
  <pre><code>doLogin(event) {    
      var user1 =this.loginForm.value;
      var password = this.loginForm.controls.password.value;
      this.homeService.doLogin(user1).subscribe(
          user =&gt;{
              this.user = user.results; 
              this.storage.set('isLoggedIn', 'shahjad');
              this.navCtrl.setRoot(DashboardComponent, {thing1: user });
          },
          err =&gt; {
              console.log(err);
          },
          () =&gt; console.log('login complete')
  
          );
  }
  </code></pre>
  
  <p>Now, I want to call student component'function from dashboard Component </p>
  
  <p>I created student component like <strong>students.ts</strong></p>
  
  <pre><code>@Component({
  
      selector: 'page-students',
      templateUrl: "./students.html"
  })
  export class StudentsComponent {
      dashboardItem: any;
      mode = "Observable";
      errorMessage: string;
  
      constructor(public fb: FormBuilder,private studentsService: StudentsService,public navCtrl: NavController,private storage: Storage,private menu: MenuController) {}
  
      fetchAllClass(event) {  
  
          alert("fd");
      }
  }
  </code></pre>