<commit_before>'use strict';

angular.module('myApp.view1', ['ngRoute'])

.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/view1', {
    templateUrl: 'view1/view1.html',
    controller: 'View1Ctrl'
	  //resolve: {
		//  employees: ['myAppService', function(myAppService){
		//	  var employees = myAppService.getEmployees();
		//  }]
	  //}
  });
}])

.service('myAppService', function($http, $q) {
	var deferred = $q.defer();
	$http.get('/assets/js/employees.json').then(function(data) {
		deferred.resolve(data);
	});
	this.getEmployees = function() {
		return deferred.promise;
	}
})

.controller('View1Ctrl', ['$scope', 'myAppService', function($scope, myAppService) {

		//todo: Figure out how to select an employee by ID and highlight the specific employee light teal

		var promise = myAppService.getEmployees();
		promise.then(function(data) {
			$scope.employees = data.data;
			console.log($scope.employees);
		});
	}
]);<commit_msg>Updated todo/comments in view1 js file<commit_after>'use strict';

angular.module('myApp.view1', ['ngRoute'])

.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/view1', {
    templateUrl: 'view1/view1.html',
    controller: 'View1Ctrl'
	  //resolve: {
		//  employees: ['myAppService', function(myAppService){
		//	  var employees = myAppService.getEmployees();
		//  }]
	  //}
  });
}])


	//Don't really know about this service below's logic yet sadly, learned from Accio Code on YouTube.
	//todo: investigate more how promises work in general, and $q.

.service('myAppService', function($http, $q) {
	var deferred = $q.defer();
	$http.get('/assets/js/employees.json').then(function(data) {
		deferred.resolve(data);
	});
	this.getEmployees = function() {
		return deferred.promise;
	}
})

.controller('View1Ctrl', ['$scope', 'myAppService', function($scope, myAppService) {

		//todo: Figure out how to select an employee by ID and highlight the specific employee light teal

		var promise = myAppService.getEmployees();
		promise.then(function(data) {
			$scope.employees = data.data; // todo: Why is this data.data? Not understanding what .data does - Find Answer.
			console.log($scope.employees);
		});
	}
]);
{'fraction_non_alphanumeric': 0.16930022573363432, 'fraction_numerical': 0.005869074492099322, 'mean_word_length': 4.238770685579196, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7203797', 'n_tokens_mistral': 773, 'n_tokens_neox': 718, 'n_words': 161}