Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component } from '@angular/core';
- import { NavController } from 'ionic-angular';
- import { Api} from '../../providers/api/api';
- import { SinglePage } from '../single/single'
- @Component({
- templateUrl: 'build/pages/home/home.html',
- providers: [Api]
- })
- export class HomePage {
- datas:any;
- constructor(public navCtrl: NavController, private api: Api) {
- api.index(1).subscribe( data => {
- this.datas = data.json();
- });
- }
- openSinglePage(url){
- this.navCtrl.push(SinglePage, {
- url:url
- })
- }
- search(keyword){
- this.api.search(keyword,1).subscribe(data=>{
- this.datas = data.json()
- });
- }
- onCencel(ev){
- if(!ev.target.value){
- this.api.index(1).subscribe(data => {
- this.datas = data.json();
- })
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment