Commit e2f2856a by Adarsh K

changes

parent 6f7f32fe
// tslint:disable-next-line:max-line-length
import { AfterViewInit, Component, ContentChildren, Directive, ElementRef, Input, OnInit, QueryList, TemplateRef, ViewChild, ViewChildren } from '@angular/core'; import { AfterViewInit, Component, ContentChildren, Directive, ElementRef, Input, OnInit, QueryList, TemplateRef, ViewChild, ViewChildren } from '@angular/core';
import { CarouselDirective } from './../../directives/carousel.directive'; import { CarouselDirective } from './../../directives/carousel.directive';
import { animate, AnimationBuilder, AnimationFactory, AnimationPlayer, style } from '@angular/animations'; import { animate, AnimationBuilder, AnimationFactory, AnimationPlayer, style } from '@angular/animations';
...@@ -15,7 +16,7 @@ export class CarouselItemElement { ...@@ -15,7 +16,7 @@ export class CarouselItemElement {
styleUrls: ['./carousel.scss'] styleUrls: ['./carousel.scss']
}) })
export class CarouselComponent implements AfterViewInit { export class CarouselComponent implements AfterViewInit {
@ContentChildren(CarouselDirective) items: QueryList<CarouselDirective>; @ContentChildren(CarouselDirective) items: QueryList<CarouselDirective>;
@ViewChildren(CarouselItemElement, { read: ElementRef }) private itemsElements: QueryList<ElementRef>; @ViewChildren(CarouselItemElement, { read: ElementRef }) private itemsElements: QueryList<ElementRef>;
@ViewChild('carousel', {static: false}) private carousel: ElementRef; @ViewChild('carousel', {static: false}) private carousel: ElementRef;
@Input() timing = '250ms ease-in'; @Input() timing = '250ms ease-in';
...@@ -23,7 +24,7 @@ export class CarouselComponent implements AfterViewInit { ...@@ -23,7 +24,7 @@ export class CarouselComponent implements AfterViewInit {
private player: AnimationPlayer; private player: AnimationPlayer;
private itemWidth: number; private itemWidth: number;
private currentSlide = 0; private currentSlide = 0;
carouselWrapperStyle = {} carouselWrapperStyle = {};
next() { next() {
if (this.currentSlide + 1 === this.items.length) return; if (this.currentSlide + 1 === this.items.length) return;
...@@ -52,6 +53,7 @@ export class CarouselComponent implements AfterViewInit { ...@@ -52,6 +53,7 @@ export class CarouselComponent implements AfterViewInit {
} }
constructor(private builder: AnimationBuilder) { constructor(private builder: AnimationBuilder) {
console.log(this.items);
} }
ngAfterViewInit() { ngAfterViewInit() {
......
...@@ -7,4 +7,8 @@ ...@@ -7,4 +7,8 @@
width: auto; width: auto;
} }
} }
}
.carousel-inner {
display: flex;
} }
\ No newline at end of file
import {Component,OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
@Component({ @Component({
selector: 'offers', selector: 'offers',
...@@ -7,13 +7,14 @@ import {Component,OnInit} from '@angular/core'; ...@@ -7,13 +7,14 @@ import {Component,OnInit} from '@angular/core';
}) })
export class OffersComponent { export class OffersComponent {
items = [ items: any;
{ title: 'Airfares starting at Rs. 899*', desc: 'Flights, 1080 Hotels, 410 Homestays,<br> Holiday Packages get 1080 Hotels, 410 Homestays..', code: 'AT 500' },
{ title: 'Airfares starting at Rs. 899*', desc: 'Flights, 1080 Hotels, 410 Homestays,<br> Holiday Packages get 1080 Hotels, 410 Homestays..', code: 'AT 500' },
{ title: 'Airfares starting at Rs. 899*', desc: 'Flights, 1080 Hotels, 410 Homestays,<br> Holiday Packages get 1080 Hotels, 410 Homestays..', code: 'AT 500' },
]
ngOnInit() { ngOnInit() {
this.items = [
{ title: 'Airfares starting at Rs. 899*', desc: 'Flights, 1080 Hotels, 410 Homestays,<br> Holiday Packages get 1080 Hotels, 410 Homestays..', code: 'AT 500' },
{ title: 'Airfares starting at Rs. 899*', desc: 'Flights, 1080 Hotels, 410 Homestays,<br> Holiday Packages get 1080 Hotels, 410 Homestays..', code: 'AT 500' },
{ title: 'Airfares starting at Rs. 899*', desc: 'Flights, 1080 Hotels, 410 Homestays,<br> Holiday Packages get 1080 Hotels, 410 Homestays..', code: 'AT 500' },
]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment