I am using NodeJS and AngularJS.
Within Angular I would like to reference a json file and seperate parts of the json into different controllers.
At the moment I am using http.get within the controller (see below).
var app = angular.module('app', []);
app.controller('introCtrl', function ($scope, $http) {
$http.get('src/data_json.js').success(function(data) {
$scope.intro = data;
});
This returns the entire json object within my first controller. However I would like to require the json file, store it as a variable, and have multiple controllers reference different parts.
Is there a way to use nodejs to pass the json file to the angular controller Or is there a better way to require the json file using angular?
Many thanks