title: call a function inside ngfor
body: <p>I'm quite new in angular2. </p>
  
  <p>I have an ionic2 application and what I would like is to call a function inside an ngfor loop. The code I'm using is the following but it doesn't work as I expected:</p>
  
  <pre><code>@Component({
    selector: 'page-mypage',
    templateUrl: 'mypage.html',
  })
  export class MyPage {
  
    itemlist = [
      {id:1, testf:"test1"},
      {id:2, testf:"test2"}
    ]; 
  
    constructor(public navCtrl: NavController, public navParams: NavParams,private viewCtrl: ViewController) {
    }
  
    ionViewDidLoad() {
      console.log('ionViewDidLoad MyPage');
    }
  
  
    myFunction(testf){
  
      console.log(testf);
  
      return testf;
  
    } 
  
  }
  </code></pre>
  
  <p>and in html I have the following:</p>
  
  <pre><code>&lt;div *ngFor="let item of itemlist"&gt;
    {{ myFunction(item.testf) }}
  &lt;/div&gt;
  </code></pre>
  
  <p>Although the output is printed twice as the number of item list, the function seems to be called multiple times. Any suggestions?</p>