-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different uiScrollViewport schemes when using as a component #239
Comments
@ornic If you are going to augment Viewport module, an easier approach might be as follows. Template: <ul class="list-group" ui-scroll-viewport="$ctrl.checkRestrictHeight()"> Directive: .directive('uiScrollViewport', function () {
return {
restrict: 'A',
scope: { window: '=uiScrollViewport' }, // new line, assign directive attr value to scope.window
controller: [
// ... Viewport: const ctrl = viewportController;
const isViewport = ctrl && ctrl.scope && ctrl.scope.window !== false;
const scope = isViewport ? ctrl.scope : $rootScope;
const viewport = isViewport && ctrl.viewport ? ctrl.viewport : angular.element(window);
const container = isViewport && ctrl.container ? ctrl.container : undefined; Note, the explicit check is used: |
This way code looks more readable than in my crude variant. But I found that after defining scope in UPD: I looked further and it seems that this approach should be Ok, since the only result AFAIK is always using scope of |
I didn't meet any issues with the Adapter when using the suggested approach. |
I am trying to use great ui-scroll module inside one of the components. This is a (surprise!) list, but i need to show it both inside window (no viewport) or inside popup (with viewport).
The only way I know to tell ui-scroll about viewport is
ui-scroll-viewport
attribute. And the only way I can tell Angular about optional attribute isng-attr-
prefix. I want it to be optional attribute, since I hate to copy-paste the same code in ng-switches.And this is a place when things get interesting. According to angular/angular.js#16441 ui-scroll gets information about
ui-scroll-viewport
attribute before evaluation ofng-attr-ui-scroll-viewport
value.May be someone will point me to more "right" solution. But for now I had to patch ui-scroll.js file.
max-height
style inside some param to the componentng-attr-ui-scroll-viewport
valueThe text was updated successfully, but these errors were encountered: