introducing config.json for IP:PORT
This commit is contained in:
parent
c6e55d39d7
commit
f4f9da8522
6
labs/demos/config.json
Normal file
6
labs/demos/config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"settings": {
|
||||
"IP": "http://192.168.0.203",
|
||||
"PORT": "4000"
|
||||
}
|
||||
}
|
@ -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));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user