Created
January 24, 2019 04:16
-
-
Save saimon24/d6f2420e1bbd0eac335a86a53c18a39f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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