aboutsummaryrefslogtreecommitdiffstats
path: root/example/index.js
blob: c742c1e363e18f942b1d98052d6b3061512bcf33 (plain)
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
angular
  .module('nsPopoverExample', ['nsPopover'])

  .controller('MainCtrl', function($scope) {
    $scope.items = [{
      name: "Action"
    }, {
      name: "Another action"
    }, {
      name: "Something else here"
    }];
  })

  .directive('viewportWidth', function() {
    return {
      link: function(scope, elm, attrs) {
        function getViewport() {
          var e = window, a = 'inner';
          if (!('innerWidth' in window)) {
            a = 'client';
            e = document.documentElement || document.body;
          }
          return {
            width : e[a + 'Width'] ,
            height : e[a + 'Height']
          };
        }

        elm.css('maxWidth', getViewport().width + 'px');
      }
    };
  });