Closed
Description
Update: Check the solution here
Hi @TheOriginalJosh,
Thanks for this amazing plugin.
I'm trying to setup with Angular, following your instructions, but I'm very confused. It's not really clear what steps I need to follow.
Could you please help me to build an example? That's what I have so far. Thanks:
import {Component, OnInit} from '@angular/core';
import {registerElement, ViewClass} from "nativescript-angular/element-registry";
var SlideContainer = require("nativescript-slides").SlideContainer;
SlideContainer.angular = true; // set the SlideContainer's property of angular to true
registerElement("SlideContainer", () => SlideContainer);
@Component({
selector: 'slidedemo',
template: `
<SlideContainer>
<Slide class="slide-1" *ngFor="let img of images">
<Label [text]="img.title"></Label>
<Image [src]="img.source"></Image>
</Slide>
</SlideContainer>
`
})
export class SlideDemoComponent implements OnInit {
public images: Array<any> = [];
ngOnInit() {
this.images.push(
{
title: 'Sports',
source: 'http://lorempixel.com/400/200/sports/1/'
}
);
this.images.push(
{
title: 'Cats',
source: 'http://lorempixel.com/400/200/cats/1/'
}
);
this.images.push(
{
title: 'Food',
source: 'http://lorempixel.com/400/200/food/1/'
}
);
}
/**
* Then in your angular component in the ngAfterViewInit.
* you will want to have an instance of your slide container to call the function constructView().
*/
ngAfterViewInit() {
SlideContainer.constructView();
}
}
Metadata
Metadata
Assignees
Labels
No labels