-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.ts
37 lines (31 loc) · 1.37 KB
/
app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// angular init/start
module App {
// start up an angular module and the controllers
var app = angular.module('omscs-course-app', ['ngTable']);
var ser: Serialization = new Serialization();
app.factory('updateService', function () {
return {
completedSelection: function (id: number) {
var completed = App.Cookies.parseCompletedCookies();
// force it to be number
id = parseInt(id.toString());
var idx = completed.indexOf(id);
if (idx > -1) {
completed.splice(idx, 1); // then remove
} else {
completed.push(id); // then add
}
App.Cookies.updateCompletedCookies(completed);
ser.updateCompletedList(completed);
}
};
});
app.run(function ($rootScope, updateService) {
$rootScope.omsapp = updateService;
});
app.controller('courselistcontroller', ($scope, NgTableParams) => new App.CourseListController($scope, NgTableParams));
app.controller('coursematrixcontroller', ($scope, NgTableParams) => new App.CourseMatrixController($scope, NgTableParams));
app.controller('speclistcontroller', ($scope, NgTableParams) => new App.SpecListController($scope, NgTableParams));
ser.loadCourses();
ser.loadSpecializations();
}