Adding changes in existing model 54/78754/1
authorSwapnali Shadanan Pode <sp00501638@techmahindra.com>
Tue, 19 Feb 2019 13:22:43 +0000 (18:52 +0530)
committerSwapnali Shadanan Pode <sp00501638@techmahindra.com>
Tue, 19 Feb 2019 13:22:43 +0000 (18:52 +0530)
Adding search model to existing template

Change-Id: I1c9f7b6e444fef585bea621e5017a0f78376885f
Issue-ID: CCSDK-804
Signed-off-by: sp00501638 <sp00501638@techmahindra.com>
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/existing-model.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/existing-model.module.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts

index e88f636..2963cfc 100644 (file)
 
 import { NgModule } from '@angular/core';
 import { CommonModule } from '@angular/common';
-
+import { SearchResourceComponent } from './search-resource/search-resource.component';
 import { ExistingModelRoutingModule } from './existing-model-routing.module';
+import { ExistingModelComponent } from './existing-model.component';
 
 @NgModule({
-  declarations: [],
+  declarations: [ExistingModelComponent,SearchResourceComponent],
   imports: [
     CommonModule,
-    ExistingModelRoutingModule
-  ]
+    ExistingModelRoutingModule,
+    SearchResourceComponent,
+  ],
+  exports:[ExistingModelComponent,
+    SearchResourceComponent]
 })
 export class ExistingModelModule { }
index 68ea10b..ab69628 100644 (file)
 * ============LICENSE_END=========================================================
 */-->
 
-
-<p>
-  search-resource works!
-</p>
+<form class="example-form" [formGroup]="myControl">
+  <mat-form-field class="example-full-width">
+    <input type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input">
+    <button matSuffix mat-icon-button><mat-icon>search</mat-icon></button>
+    <mat-autocomplete #auto="matAutocomplete">
+      <mat-option *ngFor="let option of options | search : searchText" [value]="option">
+        {{option}}
+      </mat-option>
+    </mat-autocomplete>
+  </mat-form-field>
+</form>
index 8759adf..16129b7 100644 (file)
 */
 
 import { Component, OnInit } from '@angular/core';
-
+import {FormBuilder, FormGroup, Validators} from '@angular/forms';
 @Component({
   selector: 'app-search-resource',
   templateUrl: './search-resource.component.html',
   styleUrls: ['./search-resource.component.scss']
 })
-export class SearchResourceComponent implements OnInit {
+export class SearchResourceComponent implements OnInit  {
 
-  constructor() { }
+   myControl: FormGroup;
 
-  ngOnInit() {
+  constructor(private _formBuilder: FormBuilder)  { }
+  
+  options: string[] = ['One','One1', 'Two', 'Three'];
+    
+    ngOnInit() {
+    this.myControl = this._formBuilder.group({
+      search_input: ['', Validators.required]
+    });
   }
-
+    
 }
+