diff options
Diffstat (limited to 'example/index.js')
| -rw-r--r-- | example/index.js | 21 | 
1 files changed, 21 insertions, 0 deletions
| diff --git a/example/index.js b/example/index.js index 6315168..c742c1e 100644 --- a/example/index.js +++ b/example/index.js @@ -1,5 +1,6 @@  angular
    .module('nsPopoverExample', ['nsPopover'])
 +
    .controller('MainCtrl', function($scope) {
      $scope.items = [{
        name: "Action"
 @@ -8,4 +9,24 @@ angular      }, {
        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');
 +      }
 +    };
    });
\ No newline at end of file | 
