JSFiddle - React, Tailwind, and code Playground
by mrcl
HTML
<div ng-app="dashboardApp">
<h1>
B
</h1>
<div ng-controller="Liste1" ng-init="setB('b');">
<span>{{buchstabe}}</span>
<table>
<tbody>
<tr ng:repeat="i in entries"><td>{{$index}}</td>
<td>{{i.continent}}</td>
<td>{{i.name}}</td>
<td>{{i.postalCodes[0]}}</td>
<td>{{i.coordinate.latitude}} {{i.coordinate.longitude}}</td></tr>
</tbody>
</table>
</div>
<h1>
A
</h1>
<div ng-controller="Liste1" ng-init="setB('a');">
<span>{{buchstabe}}</span>
<table>
<tbody>
<tr ng:repeat="i in entries"><td>{{$index}}</td>
<td>{{i.continent}}</td>
<td>{{i.name}}</td>
<td>{{i.postalCodes[0]}}</td>
<td>{{i.coordinate.latitude}} {{i.coordinate.longitude}}</td></tr>
</tbody>
</table>
</div>
</div>
CSS
tr:nth-child(even) td { background-color:lightblue; }
JavaScript
var app = angular.module('dashboardApp', []);
app.factory('dashSession', function ($http){
return function(buchstabe){
return $http({
method: 'GET',
url: 'https://exporte2.wdr.de/WDRWetterWebsite/app/search/suggestions.json',
params: { query: buchstabe }
});
}
});
app.controller('Liste1', function (dashSession,$scope,$http){
$scope.setB = function(buchstabe) {
$scope.buchstabe = buchstabe;
console.log(buchstabe);
dashSession($scope.buchstabe)
.success(function (data) {
console.log(data);
$scope.entries=data;
});
};
});