Skip to content

Commit

Permalink
Create index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
oybek authored Aug 10, 2023
0 parents commit b0e4100
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<html ng-app="custom-webapp-ui" lang="en" style="background-color: white">
<head>
<!-- Load the Telegram Library -->
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<!--Load the AngularJS Library-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
<script>
//initialize the AngularJS stuff...
angular.module("custom-webapp-ui", []).controller('CustomUIController', function CustomUIController($scope) {
//init our slider values that we will display
$scope.foods = [
{ name: "fruits", value: 5 },
{ name: "vegetables", value: 5 },
{ name: "meat", value: 5 },
{ name: "dairy", value: 5 }
];
//initialize the button
const mainButton = window.Telegram.WebApp.MainButton;
mainButton.text = "Save Preferences";
mainButton.enable();
mainButton.show();
// and make it send the "foods" object (as JSON string) back to the bot
mainButton.onClick(function(){
window.Telegram.WebApp.sendData(JSON.stringify($scope.foods));
})
});
</script>
</head>
<body ng-controller="CustomUIController">
<div ng-repeat="food in foods">
<div style="width: 100px; display: inline-block">{{food.name}} : {{food.value}}</div>
<input style="display: inline-block" type="range" min="1" max="10" ng-model="food.value" value="{{food.value}}">
</div>
</body>
</html>

0 comments on commit b0e4100

Please sign in to comment.