I have an angular controller that calls a service. The service is responsible for returning data from a json file.
controller:
function projectController
You need to use $q. Example is here