Skip to content

Instantly share code, notes, and snippets.

@ccoenraets
Created February 1, 2016 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccoenraets/dfe759c63827647f93c2 to your computer and use it in GitHub Desktop.
Save ccoenraets/dfe759c63827647f93c2 to your computer and use it in GitHub Desktop.
import {OnInit} from 'angular2/core';
import {Page, NavController, NavParams} from 'ionic/ionic';
import {PropertyDetailsPage} from '../property-details/property-details';
import {PropertyService} from '../../services/property-service';
@Page({
templateUrl: 'build/pages/property-list/property-list.html'
})
export class PropertyListPage {
constructor(nav:NavController, navParams:NavParams, propertyService:PropertyService) {
this.nav = nav;
this.propertyService = propertyService;
this.selectedItem = navParams.get('item');
}
ngOnInit() {
this.propertyService.findAll().then(data => this.properties = data);
}
itemTapped(event, property) {
this.nav.push(PropertyDetailsPage, {
property: property
});
}
}
import {Injectable} from 'angular2/core';
import {PROPERTIES} from './mock-properties';
@Injectable()
export class PropertyService {
findAll() {
return new Promise((resolve, reject) => {
resolve(PROPERTIES);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment