-
Notifications
You must be signed in to change notification settings - Fork 1
/
sampleApp.js
58 lines (50 loc) · 1.08 KB
/
sampleApp.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(function() {
'use strict';
angular
.module('sampleApp', ['enl.utils']);
angular
.module('sampleApp')
.controller('MainCtrl', MainCtrl);
MainCtrl.$inject = ['$scope', 'mediaCheck'];
function MainCtrl($scope, mediaCheck) {
var main = this;
// private variables
var mc = mediaCheck.init({
scope: $scope,
media: [
{
mq: '(max-width: 768px)',
enter: function(mq) {
console.log('entering', mq.media);
},
exit: function(mq) {
console.log('exiting', mq.media);
}
}
,{
mq: '(min-width: 1024px)',
enter: function(mq) {
console.log('entering', mq.media);
},
exit: function(mq) {
console.log('exiting', mq.media);
}
}
],
debounce: 100
});
// bindable members
main.items = ['item', 'item2', 'item3'];
$scope.$on('list-repeated', _$onListRepeated);
/**
* $on list-repeated custom event
*
* @param $event {event}
* @param args {object}
* @private
*/
function _$onListRepeated($event, args) {
console.log('List repeat completed! Arguments:', args);
}
}
})();