scrollPosition - baScrollPosition

This commit is contained in:
nixa 2016-05-18 16:45:01 +03:00
parent 8b673b1f48
commit 5f360a73a8
6 changed files with 12 additions and 11 deletions

View file

@ -3,13 +3,13 @@ import {Component, ViewEncapsulation} from '@angular/core';
import {AppState} from '../../../app.state'; import {AppState} from '../../../app.state';
import {ProfilePicturePipe} from '../../pipes'; import {ProfilePicturePipe} from '../../pipes';
import {MsgCenter} from '../../components/msgCenter'; import {MsgCenter} from '../../components/msgCenter';
import {ScrollPosition} from '../../directives'; import {BaScrollPosition} from '../../directives';
@Component({ @Component({
selector: 'page-top', selector: 'page-top',
styles: [require('./pageTop.scss')], styles: [require('./pageTop.scss')],
template: require('./pageTop.html'), template: require('./pageTop.html'),
directives: [MsgCenter, ScrollPosition], directives: [MsgCenter, BaScrollPosition],
pipes: [ProfilePicturePipe], pipes: [ProfilePicturePipe],
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })

View file

@ -1,4 +1,4 @@
<div class="page-top clearfix" scrollPosition maxHeight="50" (scrollChange)="scrolledChanged($event)" <div class="page-top clearfix" baScrollPosition maxHeight="50" (scrollChange)="scrolledChanged($event)"
[ngClass]="{scrolled: isScrolled}"> [ngClass]="{scrolled: isScrolled}">
<a href="#/pages/dashboard" class="al-logo clearfix"><span>ng2-</span>admin</a> <a href="#/pages/dashboard" class="al-logo clearfix"><span>ng2-</span>admin</a>
<a (click)="toggleMenu()" class="collapse-menu-link ion-navicon"></a> <a (click)="toggleMenu()" class="collapse-menu-link ion-navicon"></a>

View file

@ -1,15 +1,16 @@
import {Directive, Input, Output, EventEmitter, HostListener} from '@angular/core'; import {Directive, Input, Output, EventEmitter, HostListener} from '@angular/core';
@Directive({ @Directive({
selector: '[scrollPosition]' selector: '[baScrollPosition]'
}) })
export class ScrollPosition { export class BaScrollPosition {
@Input() maxHeight:Number;
@Output() scrollChange:EventEmitter<Boolean> = new EventEmitter<Boolean>();
private _isScrolled:Boolean; @Input() public maxHeight:number;
@Output() public scrollChange:EventEmitter<boolean> = new EventEmitter<boolean>();
ngOnInit() { private _isScrolled:boolean;
public ngOnInit():void {
this.onWindowScroll(); this.onWindowScroll();
} }

View file

@ -0,0 +1 @@
export * from './baScrollPosition.directive.ts';

View file

@ -1,2 +1,2 @@
export * from './scrollPosition'; export * from './baScrollPosition';
export * from './baThemeRun'; export * from './baThemeRun';

View file

@ -1 +0,0 @@
export * from './scrollPosition.directive.ts';