Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. import { BrowserModule } from '@angular/platform-browser';
  2. import { NgModule } from '@angular/core';
  3. import { FormsModule } from '@angular/forms';
  4. import { AppRoutingModule } from './app-routing.module';
  5. import { AppComponent } from './app.component';
  6. import { SearchFormComponent } from './components/search-form/search-form.component';
  7. import { QueryDisplayComponent } from './components/query-display/query-display.component';
  8. import { HttpClientModule } from '@angular/common/http';
  9.  
  10.  
  11. @NgModule({
  12. declarations: [
  13. AppComponent,
  14. SearchFormComponent,
  15. QueryDisplayComponent
  16. ],
  17. imports: [
  18. BrowserModule,
  19. AppRoutingModule,
  20. FormsModule,
  21. HttpClientModule
  22. ],
  23. exports:[],
  24. providers: [],
  25. bootstrap: [AppComponent]
  26. })
  27. export class AppModule { }
  28.  
  29. <div style="text-align:center">
  30. <h1>
  31. Places Search
  32. </h1>
  33. </div>
  34.  
  35.  
  36. <router-outlet></router-outlet>
  37.  
  38. import { Component, OnInit } from '@angular/core';
  39. // import { Place } from '../../place'
  40. import { GetReqPlaces } from '../../services/get-req-places.service'
  41. import { Router } from '@angular/router'
  42.  
  43.  
  44. @Component({
  45. selector: 'app-search-form',
  46. templateUrl: './search-form.component.html',
  47. styleUrls: ['./search-form.component.css']
  48. })
  49. export class SearchFormComponent implements OnInit {
  50.  
  51. constructor(private getPlaces: GetReqPlaces, private router: Router) { }
  52.  
  53. westLong: number;
  54. eastLong: number;
  55. northLat: number;
  56. southLat: number;
  57.  
  58. // log(x){console.log(x)}
  59. onSubmit(form){
  60.  
  61. this.westLong = form.value.wLong; //
  62. this.eastLong = form.value.eLong; //
  63. this.northLat = form.value.nLat; //
  64. this.southLat = form.value.sLat; //
  65. console.log(this.getPlaces.getPlaces(this.westLong,this.southLat,this.eastLong,this.northLat))
  66. }
  67.  
  68. }
  69.  
  70. import { NgModule } from '@angular/core';
  71. import { Routes, RouterModule } from '@angular/router';
  72. import { AppComponent} from './app.component'
  73. import { SearchFormComponent} from '../components/search-form.component'
  74.  
  75.  
  76. const routes: Routes = [
  77.  
  78. { path: 'search', component: SearchFormComponent },
  79.  
  80.  
  81. ];
  82.  
  83. @NgModule({
  84. imports: [RouterModule.forRoot(routes)],
  85. exports: [RouterModule]
  86. })
  87. export class AppRoutingModule { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement