Skip to content Skip to sidebar Skip to footer

How To Send List Of Files To Angularjs Options From Node.js?

I am getting files from directory('app/jsonfiles') in node.js, and I am not sure how can I send this list of files to my front-end as options in select list to write one common get

Solution 1:

Inject Main service into MainCtrl and call the service.

  var app = angular.module('plunker', [MainService]);
    app.controller('MainCtrl', function($scope,$http, $timeout, Main) {
    $scope.JSONFiles = [];

    Main.get().success(function(data){
     data.forEach(function(obj){
      $scope.JSONFiles.push(obj);
     })
     });
    $scope.selectedjson ="";
    $scope.textAreaData = "";
    $scope.optionChanged = function(){
      $scope.textAreaData = $scope.selectedjson;
    }

    });

Post a Comment for "How To Send List Of Files To Angularjs Options From Node.js?"