introducing config.json for IP:PORT

This commit is contained in:
Anton Georgiev 2014-05-12 15:40:48 +00:00
parent c6e55d39d7
commit f4f9da8522
3 changed files with 13 additions and 2 deletions

6
labs/demos/config.json Normal file
View File

@ -0,0 +1,6 @@
{
"settings": {
"IP": "http://192.168.0.203",
"PORT": "4000"
}
}

View File

@ -1,10 +1,14 @@
var myModule = angular.module('landingPage', []);
myModule.controller('MainCtrl', function($scope, $http) {
$scope.postUsername = function(username) {
console.log("the passed uname=" + this.username);
$http.post('http://192.168.0.203:4000/login?username=' + $scope.username).success(function(res){
console.log("SUCCESS," + JSON.stringify(res.hi));
jQuery.getJSON("config.json", function (json) {
$http.post(json.settings.IP + ':' + json.settings.PORT + '/login?username=' + $scope.username).success(function(res){
console.log("SUCCESS," + JSON.stringify(res.hi));
});
});
}
});

View File

@ -2,6 +2,7 @@
<html ng-app="landingPage">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="../public/js/app.js"></script>
</head>
<body>