我正在开发卡路里计数应用程序。我基本上使用了tab离子项目并将其设置为2个选项卡(饭菜和卡路里计算器)。我不知道如何添加按钮,一旦点击就允许用户输入卡路里(正整数)。我是离子新手,无法找到答案。
如何在tab-dash.html的离子列表中引用html的此代码,以便用户可以单击按钮并输入整数?这是我的tab-dash.html:
<h4>Breakfast</h4>
<ion-item class = "item-avatar item-button-right" href="#">
<img src="img/breakfast.png">
<button class="button button-assertive" onClick="Enter Number">Calories</button>
非常感谢。
答案 0 :(得分:0)
您的Html页面中的按钮
<input type="submit" ng-click="click()">
在控制器中定义此方法
angular.module('appname', ['ionic'])
.controller('YourCtrl', function($scope, $ionicModal) {
// Create and show the popup
$ionicModal.fromTemplateUrl('popup.html', function(modal) {
$scope.popupModal = modal;
}, {
scope: $scope,
animation: 'slide-in-up'
});
// Open button CLick
$scope.click= function() {
//Show your popup
$scope.popupModal.show();
};
})