index.html:
个人所得税计算器
个人所得税:
calculatorCtrl.js:
angular.module('calculator.controllers', [])
.controller("calculatorCtrl", function ($scope) {
$scope.cal = function () {
var left = $scope.shouru - 3500;
if (left <= 1500) {
yingjiao = left * 0.03;
}
else if (left <= 4500) {
yingjiao = left * 0.1 - 105;
}
else if (left <= 9000) {
yingjiao = left * 0.2 - 555;
}
else if (left <= 35000) {
yingjiao = left * 0.25 - 1005;
}
else if (left <= 55000) {
yingjiao = left * 0.3 - 2755;
}
else if (left <= 80000) {
yingjiao = left * 0.35 - 5505;
}
else(left > 80000)
{
yingjiao = left * 0.45 - 13505;
}
$scope.shuihou = $scope.shouru - yingjiao;
};
})
app.js:
angular.module('calculator', ['ionic','calculator.controllers'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
Ng-app 和Ng-controller 不要放在一个元素上,另外你的问题是什么。用ionic start [project_name] blank 创建项目,然后在那个基础上改就好啦