app.js 968 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. app=angular.module('app', []);
  2. app.controller('main', function($scope,$http) {
  3. $scope.news=[];
  4. $scope.getNews = function() {
  5. $http.get("/pymnts/articles/").then(
  6. function(data) {
  7. /*
  8. data.data=data.data.map(function(el) {
  9. if (el.STATUS!="DISCONNECTED")
  10. el.STATUS=el.STATUS+" "+el.ELAPSED;
  11. return el;
  12. });
  13. */
  14. $scope.news=data.data.articles;
  15. },
  16. function(data){
  17. console.log("error");
  18. console.log(data);
  19. });
  20. }
  21. $scope.getNews();
  22. /*
  23. $scope.download = function(book) {
  24. $http.post("/test/?adasasd",{"type":"BOOK","book":book}).then(
  25. function(data) {
  26. $scope.getList();
  27. },
  28. function(data){
  29. console.log("error");
  30. console.log(data);
  31. });
  32. };
  33. $scope.searchBook = function(book,extension){
  34. $http.post("/test/?ewqewqewq", {"type":"search","book":book,"extension":extension}).then(
  35. function(data) {
  36. console.log("success");
  37. $scope.getList();
  38. },
  39. function(data){
  40. console.log("err");
  41. });
  42. };
  43. */
  44. });