Add Event controller and factory
This commit is contained in:
parent
519a5e1612
commit
5b4dfce34a
|
@ -13,3 +13,12 @@ ZoneMinder.factory('Header', function($http) {
|
|||
}
|
||||
};
|
||||
});
|
||||
|
||||
ZoneMinder.factory('Event', function($http) {
|
||||
return {
|
||||
getEvent: function(eventId) {
|
||||
return $http.get('/api/events/'+ eventId +'.json');
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,30 @@
|
|||
var ZoneMinder = angular.module('ZoneMinderControllers', [])
|
||||
var ZoneMinder = angular.module('ZoneMinderControllers', []);
|
||||
|
||||
.controller('HeaderController', function($scope, Header) {
|
||||
ZoneMinder.controller('HeaderController', function($scope, Header) {
|
||||
Header.getLogState(function(results) {
|
||||
console.log(results);
|
||||
});
|
||||
});
|
||||
|
||||
ZoneMinder.controller('EventController', function($scope, $location, Event) {
|
||||
|
||||
var eventId = $location.search().eid;
|
||||
|
||||
Event.getEvent(eventId).then(function(results) {
|
||||
$scope.eventId = eventId;
|
||||
$scope.name = results.data.event.Event.Name;
|
||||
$scope.cause = results.data.event.Event.Cause;
|
||||
$scope.startTime = results.data.event.Event.StartTime;
|
||||
$scope.endTime = results.data.event.Event.EndTime;
|
||||
$scope.width = results.data.event.Event.Width;
|
||||
$scope.length = results.data.event.Event.Length;
|
||||
$scope.frames = results.data.event.Event.Frames;
|
||||
$scope.alarmFrames = results.data.event.Event.AlarmFrames;
|
||||
$scope.totScore = results.data.event.Event.TotScore;
|
||||
$scope.avgScore = results.data.event.Event.AvgScore;
|
||||
$scope.maxScore = results.data.event.Event.MaxScore;
|
||||
$scope.notes = results.data.event.Event.Notes;
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue