Guest User

Untitled

a guest
Jul 18th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <div class="container">
  2. <form [formGroup]="createForm" (ngSubmit)="onPostCreateTypeFields()" style="width:400px; margin: 0 auto;">
  3. <h1>Fields</h1>
  4.  
  5. <div class="required-field-block">
  6. <input formControlName="name" type="text" placeholder="Fields" class="form-control">
  7. <div class="required-icon">
  8. <div class="text">*</div>
  9. </div>
  10. </div>
  11.  
  12. <div class="required-field-block">
  13. <input formControlName="name" type="text" placeholder="Nome" class="form-control">
  14. <div class="required-icon">
  15. <div class="text">*</div>
  16. </div>
  17. </div>
  18.  
  19. <mat-form-field>
  20. <mat-select placeholder="Type Fields" [(ngModel)]="dataSource" name="field">
  21. <mat-option *ngFor="let field of dataSource">
  22. {{field.name}}
  23. </mat-option>
  24. </mat-select>
  25. </mat-form-field>
  26.  
  27.  
  28. <button type="submit" class="btn btn-primary" >Criar</button>
  29. </form>
  30. </div>
  31.  
  32. import { Component, OnInit } from '@angular/core';
  33. import { FieldsService } from '../Services/Fields/fields.service';
  34. import { setTheme } from '../../../node_modules/ngx-bootstrap/utils';
  35.  
  36. @Component({
  37. selector: 'app-fields',
  38. templateUrl: './fields.component.html',
  39. styleUrls: ['./fields.component.css'],
  40. providers: [FieldsService]
  41. })
  42. export class FieldsComponent implements OnInit {
  43.  
  44. selectedValue: string;
  45. private operUrl: 'api/Fields';
  46. public dataSource: Model.Itens[];
  47.  
  48. constructor(private _fieldService: FieldsService) {
  49. setTheme('bs3');
  50. }
  51.  
  52. ngOnInit() {
  53.  
  54. this._fieldService
  55. .getAll<Model.Result>()
  56. .subscribe((data: Model.Result) => {
  57. debugger;
  58. this.dataSource = data.itens;
  59. });
  60. }
  61. }
  62.  
  63. declare namespace Model{
  64. export interface Result{
  65. error: boolean;
  66. itens: Array<Itens>;
  67. message: string;
  68. }
  69.  
  70. export interface Itens{
  71. operatorId: string;
  72. name: string;
  73. }
  74. }
  75.  
  76. import {MatSelectModule} from '@angular/material/select';
  77.  
  78.  
  79.  
  80. imports: [..., MatSelectModule]
Add Comment
Please, Sign In to add comment