javascript - Angularjs change scope variable on window resize -
I am trying to change scope variable: $ scope.tab
The size changes and the $ scope.tab == 'more'
.
code:
$ scope.closeMoreTab = function () {if ($ scope.tab == 'more') $ scope.tab = 'extra'; }; Angular.element (.bind) .bind ('resize', function) ($ scope.closeMoreTab ();});
Well, it is actually calling $ scope.closeMoreTab ()
, and this is actually $ scope.tab
The variable is changing, but in reality, it does not change anything on the scene.
I tried:
console.log ($ scope);
to check the variable tab
and it actually changes to 'extras', but when I do:
< Code> & lt; Div & gt; ; {{Tab}} & lt; / Div & gt;
It shows me that the current tab variable is still 'more'
Please help me get stuck with this 1 hour and why not Is or what to do.
Thank you very much
You can get your $ scope.closeMoreTab () ;
function, as it currently changes the value, but does not do the 'triggered digest cycle: $ scope in
$$ Apply
angular.ment ($ window) .bund (' Resize ', function) ($ radius. $ Apply (function () {$ scope.closeMoreTab ();});});
Comments
Post a Comment