Skip to content

Commit

Permalink
Add experimental test (see asrob-uc3m/asrob-uc3m.github.io#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Estevez committed Jan 7, 2018
1 parent 4752b81 commit e2f73db
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
82 changes: 82 additions & 0 deletions _layouts/testing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<!doctype html>
<head>
{% include blog-head.html %}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
</head>


<body id="post-index" {% if page.image.feature %}class="feature"{% endif %}>

{% include blog-browser-upgrade.html %}
{% include blog-navigation.html %}

<div class="entry-header">
{% if page.image.credit %}<div class="image-credit">Image source: <a href="{{ page.image.creditlink }}">{{ page.image.credit }}</a></div><!-- /.image-credit -->{% endif %}
{% if page.image.feature %}
<div class="entry-image">
<img src="{{ site.url }}/img/blog/{{ page.image.feature }}" alt="{{ page.title }}">
</div><!-- /.entry-image -->
{% endif %}
<div class="header-title">
<div class="header-title-wrap">
<h1>DEF: testing</h1>
<h2>Testing JS</h2>
</div><!-- /.header-title-wrap -->
</div><!-- /.header-title -->
</div><!-- /.entry-header -->

<div id="main" role="main">
<article class="hentry">
<header class="header-title">
<div class="header-title-wrap">
<h1 class="entry-title">Testing JS with backend</h1>
<h2><span class="entry-date date published">In GitHub pages! Yeah!</span></h2>
</div><!-- /.header-title-wrap -->
</header>
<div class="entry-content" align="justify">
{% raw %}
<div ng-app="myApp" ng-controller="myCtrl">
<p>Backend url:
<input type="text" ng-model="backend_url">
<button ng-click="submit()">Get info!</button>
<p>Data received from backend:</p>
<ul>
<li>Name: {{name}}</li>
<li>Type: {{type}}</li>
<li>Working: {{working}}</li>
</ul>
</div>
{% endraw %}
</article>
</div><!-- /#main -->

<div class="footer-wrapper">
<footer role="contentinfo">
{% include blog-footer.html %}
</footer>
</div><!-- /.footer-wrapper -->

{% include blog-scripts.html %}

<!-- My angular code -->
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$scope.name = "";
$scope.type = "";
$scope.working = "";
$scope.submit = function() {
$http.get($scope.backend_url).then(function (response) {
$scope.name = response.data.name;
$scope.type = response.data.type;
$scope.working = response.data.working;
});
}
});
module.run(function($http) {
$http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';
});
</script>

</body>
</html>
5 changes: 5 additions & 0 deletions testing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
layout: testing
---

asdfasdfasdfasdf

0 comments on commit e2f73db

Please sign in to comment.