I am trying to populate an HTML table with data from an MS SQL Database. I have set my app.properties for the sql server and declared my jdbcTemplate in my .java file. I am entirely new to AngularJS and jdbcTemplate. Can someone please offer some example code or point me in the right direction?
Thank you in advance!!
table.html
<h2>Industry Maintenance SIC Table</h2>
<div ng-controller="tableController">
<p>Click <a ng-click="loadObjects()">here</a> to load data.</p>
<!-- table -->
<table class="table table-bordered table-hover table-condensed">
<tr style="font-weight: bold">
<td style="width:40%">SIC Code</td>
<td style="width:50%">SIC Code Description</td>
</tr>
<tr ng-repeat="object in objects">
<td>{{object.code}}</td>
<td>{{object.description}}</td>
</tr>
</table>
</div>
table.controller.js
(function () {
'use strict';
angular.module('support-dash.pi.table').controller('tableController', tableController);
function tableController($scope, $http){
$scope.objects = [];
$scope.loadObjects = function(){
***DONT KNOW WHAT TO PUT HERE
}
};
})();
HelloResource.java
package supportdash.api;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@Path("hello")
public class HelloResource {
@GET
public String retrieve() {
return "Hello";
}
@Autowired
JdbcTemplate jdbcTemplate;
}
/hello... And then you start building the Angular app using AJAX requests.