I have always been comfortable using the ng-repeat
in Angular, but this time I seem to be facing a problem. I am trying to populate my DOM with data from a JSON file, but for some reason, the fields are not displaying as expected. Is there something wrong with my code below?
"use strict";
var app = angular.module("tickrApp", []);
app.service("tickrService", function ($http, $q){
var deferred = $q.defer();
$http.get('app/data/jobs.json').then(function (response){
deferred.resolve(response.data);
});
this.getjobs = function () {
return deferred.promise;
}
})
.controller('tickCtrl', function($scope, tickrService) {
var promise = tickrService.getjobs();
promise.then(function (data){
$scope.jobs = data;
console.log($scope.jobs);
});
});
html
<div data-ng-repeat="newJobs in jobs">
<div>{{jobs.sector}}</div>