fabiobiondi / angular-fullscreen

AngularJS HTML5 Fullscreen
214 stars 107 forks source link

Support updating nested objects in fullscreen attribute #33

Closed tomaszkrym closed 9 years ago

tomaszkrym commented 10 years ago

The nested property in scope (i.e. 'uiControls.isFullscreen'), that is passed to the fullscreen attribute, is not updated correctly on 'FBFullscreen.change' event. Usage a nested property (with '.') in $scope is quite often, if not recommended due to the scope prototypical inheritance (http://stackoverflow.com/questions/17606936/angularjs-dot-in-ng-model)

The following code (angular-fullscreen.js, line 89) $scope[$attrs.fullscreen] = false; causes that the new property 'uiControls.isFullscreen' is set on $scope object, instead of setting property isFullscreen in $scope.uiControls object.

I see the two solutions - adopting one of the methods described in http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key or creating angular expression and evaluating it in the $scope (worse performance, but a lot less of code), i.e. replacing the line 89 with: $scope.$eval($attrs.fullscreen + '= false');