Created
June 29, 2018 02:47
-
-
Save testpilot031/0d2c21d336da45dc32b1b7d381c128da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="ja"> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta charset="utf-8"> | |
<title>Angular JSON Get Sample</title> | |
<link href="./css/style.css" rel="stylesheet" type="text/css"> | |
<link href="./css/bootstrap.css" rel="stylesheet" type="text/css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> | |
<script> | |
var app = angular.module('myApp',[]); | |
app.controller('hogeCtrl',function($scope,$http){ | |
$scope.onEditChangeResult = ""; | |
$scope.onCheckBoxChangeResult = ""; | |
//http://192.168.56.101:8000/?payload=741a3504&fCnt=1&key=2B7E151628AED2A6ABF7158809CF4F3C&dev_addr=01334E9B | |
$scope.onEditChange = function () { | |
$scope.onEditChangeResult = "http://localhost/admin/cgi/deco.py?payload=" + $scope.payload | |
+ "&fCnt=" + $scope.fcnt | |
+ "&key=" + $scope.appskey | |
+ "&dev_addr=" + $scope.dev_addr | |
+ "&direction=" + $scope.direction; | |
//読み込み中を表示 | |
$scope.loading = true; | |
//データ取得 | |
$http.get($scope.onEditChangeResult) | |
.success(function(response){ | |
//データ取得 | |
$scope.status = response.status; | |
$scope.collection = response.data; | |
//読み込み中非表示 | |
$scope.loading = false; | |
}) | |
.error(function(data,status,error){ | |
console.log('APIデータ取得失敗'); | |
}); | |
}; | |
}); | |
</script> | |
</head> | |
<body> | |
<br> | |
<div class="container" ng-app="myApp" ng-controller="hogeCtrl"> | |
<!-- 読み込み中エリア --> | |
<h3>LoRaWAN Payload 暗号化復号化ツール</h3> | |
<p>appskeyを入力すると実行されます。</p> | |
<label> | |
payload: 741a3504 | |
<input type="text" style="width:500px" class="form-control" ng-model="payload" /> | |
</label> | |
<label> | |
fcnt: 1 | |
<input type="text" style="width:500px" class="form-control" ng-model="fcnt" /> | |
</label> | |
<label> | |
devaddr: 01334E9B | |
<input type="text" style="width:500px" class="form-control" ng-model="dev_addr" /> | |
</label> | |
<label> | |
appskey: 2B7E151628AED2A6ABF7158809CF4F3C | |
<input type="text" style="width:500px" class="form-control" ng-model="appskey" ng-change="onEditChange()" /> | |
</label> | |
<label> | |
direction: UP/DOWN DefaultはUP | |
<input type="text" placeholder="UP" style="width:500px" class="form-control" ng-model="direction"/> | |
</label> | |
<div ng-show="loading"> | |
読み込んでいます。。。 | |
</div> | |
<div class="panel panel-default"> | |
<!-- status --> | |
<div class="panel-body"> | |
result : {{status}} | |
<!-- loop --> | |
</div> | |
<div class="panel-footer"> | |
<ul class="list-group"> | |
<li class="list-group-item" ng-repeat="(pKey, parent) in collection" > | |
{{pKey}} : {{parent}} | |
</li> | |
</ul> | |
</div> | |
</div> | |
<br> | |
<a href="http://localhost/admin/spec1.html" target="_blank">LoRaWAN Packet解析</a> | |
</div> | |
<div> | |
<!-- | |
<ul class="list-group"> | |
<li class="list-group-item" ng-repeat="(pKey, parent) in collection" > | |
{{pKey}} : {{parent}} | |
<ul class="list-group" ng-hide="!!parent.length"> | |
<li class="list-group-item" ng-repeat="(cKey, child) in parent">{{cKey}} : {{child}}</li> | |
</ul> | |
</li> | |
</ul> | |
--> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment