28 lines
773 B
JavaScript
28 lines
773 B
JavaScript
var app = angular.module('vocabularyApp', []);
|
|
|
|
app.controller('vocabularyController', function($scope, $http, $location) {
|
|
$scope.terms = [];
|
|
$scope.vocId = vocId();
|
|
|
|
$scope.reload = function() {
|
|
$http.get('./api/vocs/'+ encodeURIComponent($scope.vocId) + '/terms?' + $.now()).then(function successCallback(res) {
|
|
$scope.terms = res.data;
|
|
}, function errorCallback(res) {
|
|
alert('ERROR: ' + res.data.message);
|
|
});
|
|
};
|
|
|
|
$scope.newTerm = function(code, englishName, nativeName) {
|
|
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
|
|
//TODO
|
|
};
|
|
|
|
$scope.deleteTerm = function(code) {
|
|
if (confirm("Are you sure ?")) {
|
|
//TODO
|
|
}
|
|
};
|
|
|
|
$scope.reload();
|
|
});
|