How we can create Custom Component in Ionic2 RC 3?


#1

Getting Error on click
EXCEPTION: Error in ./CounterComponent class CounterComponent - inline template:6:67 caused by: self.context.decrement is not a function

import { Component,Input } from '@angular/core';

 @Component({
 selector: 'counter',
 templateUrl: 'counter.html',
})

export class CounterComponent {

inputValue: number = 0;
@Input() counterValue = 0;

constructor(){}

decrement(){
    this.counterValue--;
}

increment(){
    this.counterValue++;
}

}

Html View Part

<ion-list>
	<ion-item>
		<button  ion-button outline item-left round color="purple" (click)="increment()">
			<ion-icon name="add"></ion-icon>
		</button>
		<ion-input type="number" [counterValue]="myvalue" readonly class="simpleInput"></ion-input>
		<button ion-button outline item-right round color="purple" (click)="decrement()">
			<ion-icon name="remove"></ion-icon>
		</button>
	</ion-item>
</ion-list>