When I click the button, I want to initiate a phone call dialing the number displayed on the label. Here is my custom button:
<ActionBar>
<NavigationButton (tap)="onBackTap()" android.systemIcon="ic_menu_back"></NavigationButton>
<Label class="action-bar-title" style="font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 10px;" [text]="item.name"></Label>
</ActionBar>
<StackLayout>
<Label class="action-bar-title" style="font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 10px;" [text]="item.number"></Label>
<Button text="󿅻 Call!" (tap)="onTap()" class="my-button"></Button>
</StackLayout>
This is the method onTap() in my component:
export class ItemDetailComponent implements OnInit {
item: IDataItem;
constructor(
private _data: DataService,
private _route: ActivatedRoute,
private _routerExtensions: RouterExtensions
) { }
ngOnInit(): void {
const id = +this._route.snapshot.params.id;
this.item = this._data.getItem(id);
}
onBackTap(): void {
this._routerExtensions.back();
}
onTap(): void {
// Code to make a phone call goes here
}
}
Any suggestions on how to implement the functionality of making a phone call?