aboutsummaryrefslogtreecommitdiffstats
path: root/example/index.js
diff options
context:
space:
mode:
authorNeylor Ohmaly2014-02-05 17:24:56 -0200
committerNeylor Ohmaly2014-02-05 17:24:56 -0200
commit426617e292db2584cdfc16be8462236f0b3d8a87 (patch)
tree54b85968b44f98213ad3c2908dd60833d9289de0 /example/index.js
parentf9bcf6a35031cb1b7bb2eb0233417f67baab4827 (diff)
downloadnsPopover-426617e292db2584cdfc16be8462236f0b3d8a87.tar.bz2
Improved the README.md text.
Diffstat (limited to 'example/index.js')
-rw-r--r--example/index.js21
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