Created
August 19, 2017 13:44
-
-
Save kakobotasso/7853965735bc80cc46da71465c87a23e to your computer and use it in GitHub Desktop.
Front FIAP Arduino
This file contains hidden or 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
| <html ng-app="fiapIoT"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script> | |
| <script src="main.js"></script> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> | |
| <title>FIAP - IoT</title> | |
| </head> | |
| <body ng-controller="MainCtrl"> | |
| <div class="container"> | |
| <h1>FIAP - Iot</h1> | |
| <div class="jumbotron"> | |
| <h1>Automação residencial</h1> | |
| <p>Criando objetos inteligentes</p> | |
| <p> | |
| <button ng-click="ligar()" class="btn btn-lg btn-success">Ligar</button> | |
| <button ng-click="desligar()" class="btn btn-lg btn-danger">Desligar</button> | |
| </p> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |
This file contains hidden or 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
| var module = angular.module('fiapIoT', []); | |
| module.controller('MainCtrl', function($scope, $http){ | |
| $scope.ligar = function(){ | |
| $http.get('http://localhost:3000/liga-led') | |
| .success(function(data) { | |
| $scope.status = data; | |
| $scope.erro = ''; | |
| }) | |
| .error(function(error){ | |
| $scope.error = error; | |
| }); | |
| } | |
| $scope.desligar = function(){ | |
| $http.get('http://localhost:3000/desliga-led') | |
| .success(function(data) { | |
| $scope.status = data; | |
| $scope.erro = ''; | |
| }) | |
| .error(function(error){ | |
| $scope.error = error; | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment