Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------
- Original working directive
- --------------------------
- var sidenavDirective = angular.module('sidenavDirective', [])
- .directive('resize', function ($window) {
- return {
- restrict: 'A',
- link: function (scope, elem, attrs) {
- var winHeight = $window.innerHeight;
- elem.css('height', winHeight + 'px');
- }
- };
- });
- -----------------------------
- New Not working modified directive
- -------------------------------
- var sidenavDirective = angular.module('sidenavDirective', [])
- .directive('resize', function ($window) {
- return {
- restrict: 'A',
- link: function (scope, elem, attrs) {
- scope.$watch('window', function(newVal, oldVal){
- if(newVal!== oldVal){
- elem.css('height', winHeight + 'px');
- scope.$apply();
- }
- });
- }
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement