We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Can you help me solve the problem? app.module.ts
import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { UniversalModule } from 'angular2-universal'; import { AppComponent } from './components/app/app.component' .. import { PhotosComponent } from './components/photos/photos.component'; import { Title } from '@angular/platform-browser'; import { ImageModal } from 'angular2-image-popup/directives/angular2-image-popup/image-modal-popup'; @NgModule({ bootstrap: [ AppComponent ], declarations: [ AppComponent, PhotosComponent, ImageModal, .. ], imports: [ FormsModule, TextMaskModule, UniversalModule, // Must be first import. This automatically imports BrowserModule, HttpModule, and JsonpModule too. ImageUploadModule, RouterModule.forRoot([ { path: '', redirectTo: 'home', pathMatch: 'full' }, { path: 'photos', component: PhotosComponent }, { path: 'Account/Logout', redirectTo: "/Account/Logout" }, .. { path: '**', redirectTo: 'home' } ]) ], providers: [Title], }) export class AppModule { }
photo.componnt.ts
import { Component } from '@angular/core'; import { Http } from '@angular/http'; @Component({ selector: 'photos', template: require('./photos.component.html') }) export class PhotosComponent { public photos: IPhoto[]; constructor(http: Http) { http.get('/api/SampleData/Photos').subscribe(result => { this.photos = result.json(); }); } openModalWindow: boolean = false; imagePointer: number; images = [ { thumb: './Files/Photo1.jpg', img: './Files/Photo1', description: 'Image 1' }, { thumb: './Files/Photo2.jpg', img: './Files/Photo2', description: 'Image 2' }, { thumb: './Files/Photo3.jpg', img: './Files/Photo3', description: 'Image 3' }, ]; OpenImageModel(imageSrc, images) { //alert('OpenImages'); var imageModalPointer; for (var i = 0; i < images.length; i++) { if (imageSrc === images[i].img) { imageModalPointer = i; console.log('jhhl', i); break; } } this.openModalWindow = true; this.images = images; this.imagePointer = imageModalPointer; } cancelImageModel() { this.openModalWindow = false; } } interface IPhoto { id: number; path: string; name: string; }
photo.component.html
<p *ngIf="!photos"><em>Loading...</em></p> <div *ngIf="photos"> <p> you can directly access "ImageModel" directive for both listing thumbnails and popup images</p> <ImageModal [modalImages]="images"></ImageModal> <div *ngIf="openModalWindow"> <ImageModal [modalImages]="images" [imagePointer]="imagePointer" (cancelEvent)="cancelImageModel()"></ImageModal> </div> </div>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Can you help me solve the problem?
app.module.ts
photo.componnt.ts
photo.component.html
The text was updated successfully, but these errors were encountered: