Newer
Older
angular.module('east', []).component('east', {
templateUrl: 'east/east.template.html',
controller: function eastController($scope, $http, $interval) {
this.natalie = 1;
this.TT0101 = "";
let self = this;
this.reload = function () {
$http.get("php-db-conn/elementName.conn.php?elemId=east").then(function (resultArr) {
let rArr = [];
let resjson = angular.toJson(resultArr.data);
let res = JSON.parse(resjson);
for (let i = 0; i < res.length; i++) {
rArr.push(JSON.parse(res[i]));
}
self.NP04_MHT0100AI = rArr[0];
self.NP04_TT0100AI = rArr[1];
self.NP04_PT0106AI = rArr[2];
self.NP04_DCS_01_TE0127 = rArr[3];
$http.get("php-db-conn/alias.conn.timestamp.php").then(function (ts) {
self.timestamp = ts.data.records;
$scope.start = function() {
$scope.stop();
self.promise = $interval(self.reload, 60000);
};
$scope.stop = function() {
$interval.cancel(self.promise);
};
$scope.start();
$scope.$on('$destroy', function() {
$scope.stop();
});