Skip to content

Instantly share code, notes, and snippets.

@saimon24
Created January 24, 2019 04:16
Show Gist options
  • Save saimon24/d6f2420e1bbd0eac335a86a53c18a39f to your computer and use it in GitHub Desktop.
Save saimon24/d6f2420e1bbd0eac335a86a53c18a39f to your computer and use it in GitHub Desktop.
import { MovieService, SearchType } from './../../services/movie.service';
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
@Component({
selector: 'app-movies',
templateUrl: './movies.page.html',
styleUrls: ['./movies.page.scss'],
})
export class MoviesPage implements OnInit {
results: Observable<any>;
searchTerm: string = '';
type: SearchType = SearchType.all;
/**
* Constructor of our first page
* @param movieService The movie Service to get data
*/
constructor(private movieService: MovieService) { }
ngOnInit() { }
searchChanged() {
// Call our service function which returns an Observable
this.results = this.movieService.searchData(this.searchTerm, this.type);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment