Guest User

Untitled

a guest
Feb 17th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. <mat-toolbar color="primary">
  2. <span>MAPS</span>
  3. </mat-toolbar>
  4.  
  5. <div class="main-container">
  6. <mat-card>
  7. <div style="width: 100%">
  8. <div style="width: 500px;position: relative;">
  9. <iframe width="500" height="500" src="https://maps.google.com/maps?width=500&height=500&hl=en&q=18.22141715%2C%20-66.4132818505648+(Propiedades)&ie=UTF8&t=&z=8&iwloc=B&output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe><div style="position: absolute;width: 80%;bottom: 10px;left: 0;right: 0;margin-left: auto;margin-right: auto;color: #000;text-align: center;"><small style="line-height: 1.8;font-size: 2px;background: #fff;">Powered by <a href="http://www.googlemapsgenerator.com/nl/">https://www.googlemapsgenerator.com/nl/</a> & <a href="http://lnk.direct/7Lf4">http://lnk.direct/7Lf4</a></small></div><style>#gmap_canvas img{max-width:none!important;background:none!important}</style></div><br />
  10. </div>
  11. <div>
  12. <form [formGroup]='forma' (ngSubmit)='buscar()' >
  13. <div class="form-group">
  14. <label for="nombre">Nombre</label>
  15. <input
  16. type="text"
  17. class="form-control"
  18. id="nombre"
  19. aria-describedby="emailHelp"
  20. placeholder="Enter email"
  21. formControlName="nombre"
  22. >
  23. </div>
  24. <div class="form-group">
  25. <label for="nombre">Select</label>
  26. <select
  27. class="form-control"
  28. formArrayName="selectValues"
  29. [(ngModel)]="array"
  30. >
  31. <option *ngFor="let i of array; let idx= index" [ngValue]="c" [formControlName]="array[idx]">{{i}}</option>
  32. </select>
  33. </div>
  34. <div class="form-group">
  35. <button type="submit" class="btn btn-outline btn-primary">Enviar</button>
  36. </div>
  37. </form>
  38. </div>
  39. {{forma.valid}}
  40. </mat-card>
  41.  
  42.  
  43. </div>
  44.  
  45. import { Component } from '@angular/core';
  46. import { FormGroup, FormControl, Validators, FormArray } from '@angular/forms';
  47.  
  48. @Component({
  49. selector: 'app-root',
  50. templateUrl: './app.component.html',
  51. styleUrls: ['./app.component.scss']
  52. })
  53. export class AppComponent {
  54. title = 'mapas';
  55. forma: FormGroup;
  56. array: any[] = ['a','b','c'];
  57.  
  58.  
  59. //Para poner mas validaciones se ponen entre [] y no separados por coma ya que el tercer parametro es para validaciones async
  60. constructor(){
  61. this.forma = new FormGroup({
  62. 'nombre': new FormControl('Mathias', Validators.required),
  63. 'selectValues': new FormArray([
  64. new FormControl(this.array)
  65. ])
  66. })
  67. }
  68.  
  69. buscar(){
  70. console.log(this.forma.value);
  71. console.log(this.forma.value['selectValues'])
  72. this.forma.reset();
  73. }
  74. }
Add Comment
Please, Sign In to add comment