我的组件search-component
如下html片段
<form class="form-horizontal form-material" (ngSubmit)="Search()" id="carsearch" [formGroup]="bookCarForm"
novalidate>
<div class="row">
<div class="col-sm search-input-align">
<input [owlDateTime]="dt1" [min]="min" [owlDateTimeTrigger]="dt1" class="form-control" formControlName="start_datetime"
placeholder="Start Date & Time">
<owl-date-time #dt1></owl-date-time>
<span class="input-group-addon"><i class="fa fa-calendar fa-search-align"></i></span>
</div>
<div class="col-sm search-input-align">
<input [owlDateTime]="dt2" [min]="min" [owlDateTimeTrigger]="dt2" class="form-control" formControlName="end_datetime"
placeholder="End Date & Time">
<owl-date-time #dt2></owl-date-time>
<span class="input-group-addon "><i class="fa fa-calendar "></i></span>
</div>
<div class="col-sm search-input-align">
<div class="toggle" (click)=toggleTextBox()>
<input type="checkbox" class="check" >
<b class="b switch"></b>
<b class="b track"></b>
</div>
<h4 id="door-delivery">Door Delivery</h4>
</div>
<div class="col-sm search-input-align address">
<div *ngIf="!visability">
<input class="form-control " formControlName="Enter_address" type="text" placeholder="Enter Address"
>
</div>
<div *ngIf="visability">
<select formControlName="p_location" class="form-control selectpicker" id="select-city" >
<option data-tokens="" disabled>
<h2>select any one </h2>
</option>
<option data-tokens="Delhi">
<h2>Hebbal</h2>
</option>
<option data-tokens="Mumbai">
<h2>Yelahanka</h2>
</option>
<option data-tokens="hyderabad">
<h2>BTM</h2>
</option>
</select>
</div>
</div>
<div class="col-sm search-input-align btn-book-now">
<button type="submit" [disabled]="bookCarForm.invalid" class="btn btn-primary align-items-center btn-align">Book
Now</button>
</div>
</div>
</form>
和search-component.ts
中的内容,如下所示
@Output() searchValues = new EventEmitter();
this.storage.set("values", this.Search.value);//storing values in local storage
this.searchValues.emit("values");
此search-component
是可重用的。目前,我是Page1
中的此表单,它在page1
中选择值并重定向到page2
。在page2中,我也在使用这种形式。第1页中给出的所有值是什么,应该结转到第2页中。这样我尝试了事件Emitter
,但它没有结转值。
I tried this link,但这对我没有帮助。实现此输出的最佳方法是什么。谁能帮帮我。