how to pass data with out using selector in angular 6
Here i am using two component
1) product-filter.component (sorting product based on price)
2) products.component (all product page)
product-filter.component.html
<mat-expansion-panel expanded>
<mat-expansion-panel-header>
<mat-panel-title>
<h4>Price</h4>
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="row" fxLayoutAlign="space-between center" class="text-muted">
<span>From: <b>$matslider1.value</b></span>
<span>To: <b>$matslider2.value</b></span>
</div>
<div fxLayout="row" fxLayoutAlign="space-between center" class="filter-price">
<mat-slider color="primary" min="0" max="500" step="10" #matslider1 (input)="startPrice($event.value)"></mat-slider>
<mat-slider color="warn" min="0" max="1000" step="10" #matslider2 (input)="endPrice($event.value)"></mat-slider>
</div>
</mat-expansion-panel>
product-filter.component.ts
// #################### Shorting Start price ############################
startPrice(event: any)
this.fromPrice = event;
if (this.fromPrice == 0 && this.toPrice == 0)
this.pricesorting = this.products
else if (this.toPrice != 0)
if (this.ml != 0)
var sorting = ;
for (let i = 0; i < this.sortingdata.length; i++)
if (this.sortingdata[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.sortingdata[i]['newPrice'][0]['newPrice'] <= this.toPrice)
sorting.push(this.pricesorting[i]);
this.pricesorting = sorting;
else
this.pricesorting = ;
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.products[i]['newPrice'][0]['newPrice'] <= this.toPrice)
this.pricesorting.push(this.products[i])
else if (this.toPrice == 0)
this.pricesorting = ;
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice)
this.pricesorting.push(this.products[i])
console.log(this.pricesorting)
// #################### Shorting Ending price ############################
endPrice(event: any)
this.toPrice = event;
if (this.fromPrice > 0 && this.toPrice == 0)
var sorting =
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice)
sorting.push(this.products[i]);
this.pricesorting = sorting;
else if (this.fromPrice == 0 && this.toPrice == 0)
this.pricesorting = this.products
else if (this.ml != 0)
var sorting =
for (let i = 0; i < this.sortingdata.length; i++)
if (this.sortingdata[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.sortingdata[i]['newPrice'][0]['newPrice'] <= this.toPrice)
sorting.push(this.sortingdata[i]);
this.pricesorting = sorting;
else
this.pricesorting =
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.products[i]['newPrice'][0]['newPrice'] <= this.toPrice)
this.pricesorting.push(this.products[i])
this.buttondata = this.pricesorting;
// console.log(this.pricesorting)
products.component.html
<mat-sidenav-container>
<mat-sidenav #sidenav [opened]="sidenavOpen" [mode]="sidenavOpen ? 'side' : 'over'" class="filter-sidenav"
perfectScrollbar>
<mat-accordion displayMode="flat" multi="true">
<!-------------------- Price range ---------------------->
<app-price-filter></app-price-filter>
<!-------------------- Price range ends ---------------------->
</mat-accordion>
</mat-sidenav>
<mat-sidenav-content class="all-products" ngClass.gt-sm="p-left">
<div *ngIf="pricesorting.length == 0">
<h1 class="py-1 text-muted lh" style=" text-align: center;"> No Result Found .</h1>
</div>
<div *ngIf="pricesorting.length != 0">
<div *ngIf="viewType == 'grid'" fxLayout="row wrap" class="products-wrapper">
<div *ngFor="let product of pricesorting | paginate: itemsPerPage: count, currentPage: page " fxFlex="100"
[fxFlex.gt-sm]="viewCol" fxFlex.sm="50" class="col">
<mat-card class="product-item text-center hover-border">
<mat-chip-list *ngIf="product.discount != 0">
<mat-chip color="warn" selected="true">product.discount% OFF</mat-chip>
</mat-chip-list>
<a [routerLink]="['/products/single', product.productId]" class="image-link">
<img [src]="imageHost + product.images[0].medium" alt="">
</a>
<h4 class="category text-muted"> filterById :
product.categoryId )?.name </h4>
<a [routerLink]="['/products/single', product.productId]" class="title text-truncate">
product.name
</a>
<div fxLayout="row" fxLayoutAlign="space-between center" class="prices">
<div fxLayout="column" fxLayoutAlign="center start">
<!-- <p class="old-price text-muted"><span *ngIf="product.oldPrice">$ number : '1.2-2'</span></p> -->
<p class="new-price">$product.newPrice[0].newPrice </p>
</div>
<app-rating [ratingsCount]="product.ratingsCount" [ratingsValue]="product.ratingsValue"
[direction]="'column'"></app-rating>
</div>
<div class="divider mt-2"></div>
<div class="icons">
<app-controls [product]="product" (onOpenProductDialog)="openProductDialog(product)"></app-controls>
</div>
</mat-card>
</div>
</div>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
in this component i am able to get the products based on price sorting in console am getting it.
i want to pass this this.pricesorting
to products.component.html so please tell me how to do this
angular angularjs-directive angular6
add a comment |
Here i am using two component
1) product-filter.component (sorting product based on price)
2) products.component (all product page)
product-filter.component.html
<mat-expansion-panel expanded>
<mat-expansion-panel-header>
<mat-panel-title>
<h4>Price</h4>
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="row" fxLayoutAlign="space-between center" class="text-muted">
<span>From: <b>$matslider1.value</b></span>
<span>To: <b>$matslider2.value</b></span>
</div>
<div fxLayout="row" fxLayoutAlign="space-between center" class="filter-price">
<mat-slider color="primary" min="0" max="500" step="10" #matslider1 (input)="startPrice($event.value)"></mat-slider>
<mat-slider color="warn" min="0" max="1000" step="10" #matslider2 (input)="endPrice($event.value)"></mat-slider>
</div>
</mat-expansion-panel>
product-filter.component.ts
// #################### Shorting Start price ############################
startPrice(event: any)
this.fromPrice = event;
if (this.fromPrice == 0 && this.toPrice == 0)
this.pricesorting = this.products
else if (this.toPrice != 0)
if (this.ml != 0)
var sorting = ;
for (let i = 0; i < this.sortingdata.length; i++)
if (this.sortingdata[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.sortingdata[i]['newPrice'][0]['newPrice'] <= this.toPrice)
sorting.push(this.pricesorting[i]);
this.pricesorting = sorting;
else
this.pricesorting = ;
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.products[i]['newPrice'][0]['newPrice'] <= this.toPrice)
this.pricesorting.push(this.products[i])
else if (this.toPrice == 0)
this.pricesorting = ;
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice)
this.pricesorting.push(this.products[i])
console.log(this.pricesorting)
// #################### Shorting Ending price ############################
endPrice(event: any)
this.toPrice = event;
if (this.fromPrice > 0 && this.toPrice == 0)
var sorting =
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice)
sorting.push(this.products[i]);
this.pricesorting = sorting;
else if (this.fromPrice == 0 && this.toPrice == 0)
this.pricesorting = this.products
else if (this.ml != 0)
var sorting =
for (let i = 0; i < this.sortingdata.length; i++)
if (this.sortingdata[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.sortingdata[i]['newPrice'][0]['newPrice'] <= this.toPrice)
sorting.push(this.sortingdata[i]);
this.pricesorting = sorting;
else
this.pricesorting =
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.products[i]['newPrice'][0]['newPrice'] <= this.toPrice)
this.pricesorting.push(this.products[i])
this.buttondata = this.pricesorting;
// console.log(this.pricesorting)
products.component.html
<mat-sidenav-container>
<mat-sidenav #sidenav [opened]="sidenavOpen" [mode]="sidenavOpen ? 'side' : 'over'" class="filter-sidenav"
perfectScrollbar>
<mat-accordion displayMode="flat" multi="true">
<!-------------------- Price range ---------------------->
<app-price-filter></app-price-filter>
<!-------------------- Price range ends ---------------------->
</mat-accordion>
</mat-sidenav>
<mat-sidenav-content class="all-products" ngClass.gt-sm="p-left">
<div *ngIf="pricesorting.length == 0">
<h1 class="py-1 text-muted lh" style=" text-align: center;"> No Result Found .</h1>
</div>
<div *ngIf="pricesorting.length != 0">
<div *ngIf="viewType == 'grid'" fxLayout="row wrap" class="products-wrapper">
<div *ngFor="let product of pricesorting | paginate: itemsPerPage: count, currentPage: page " fxFlex="100"
[fxFlex.gt-sm]="viewCol" fxFlex.sm="50" class="col">
<mat-card class="product-item text-center hover-border">
<mat-chip-list *ngIf="product.discount != 0">
<mat-chip color="warn" selected="true">product.discount% OFF</mat-chip>
</mat-chip-list>
<a [routerLink]="['/products/single', product.productId]" class="image-link">
<img [src]="imageHost + product.images[0].medium" alt="">
</a>
<h4 class="category text-muted"> filterById :
product.categoryId )?.name </h4>
<a [routerLink]="['/products/single', product.productId]" class="title text-truncate">
product.name
</a>
<div fxLayout="row" fxLayoutAlign="space-between center" class="prices">
<div fxLayout="column" fxLayoutAlign="center start">
<!-- <p class="old-price text-muted"><span *ngIf="product.oldPrice">$ number : '1.2-2'</span></p> -->
<p class="new-price">$product.newPrice[0].newPrice </p>
</div>
<app-rating [ratingsCount]="product.ratingsCount" [ratingsValue]="product.ratingsValue"
[direction]="'column'"></app-rating>
</div>
<div class="divider mt-2"></div>
<div class="icons">
<app-controls [product]="product" (onOpenProductDialog)="openProductDialog(product)"></app-controls>
</div>
</mat-card>
</div>
</div>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
in this component i am able to get the products based on price sorting in console am getting it.
i want to pass this this.pricesorting
to products.component.html so please tell me how to do this
angular angularjs-directive angular6
did you try router???
– Alireza Khajavi
Nov 10 at 6:05
have you triedshared services
?
– CruelEngine
Nov 10 at 6:57
add a comment |
Here i am using two component
1) product-filter.component (sorting product based on price)
2) products.component (all product page)
product-filter.component.html
<mat-expansion-panel expanded>
<mat-expansion-panel-header>
<mat-panel-title>
<h4>Price</h4>
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="row" fxLayoutAlign="space-between center" class="text-muted">
<span>From: <b>$matslider1.value</b></span>
<span>To: <b>$matslider2.value</b></span>
</div>
<div fxLayout="row" fxLayoutAlign="space-between center" class="filter-price">
<mat-slider color="primary" min="0" max="500" step="10" #matslider1 (input)="startPrice($event.value)"></mat-slider>
<mat-slider color="warn" min="0" max="1000" step="10" #matslider2 (input)="endPrice($event.value)"></mat-slider>
</div>
</mat-expansion-panel>
product-filter.component.ts
// #################### Shorting Start price ############################
startPrice(event: any)
this.fromPrice = event;
if (this.fromPrice == 0 && this.toPrice == 0)
this.pricesorting = this.products
else if (this.toPrice != 0)
if (this.ml != 0)
var sorting = ;
for (let i = 0; i < this.sortingdata.length; i++)
if (this.sortingdata[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.sortingdata[i]['newPrice'][0]['newPrice'] <= this.toPrice)
sorting.push(this.pricesorting[i]);
this.pricesorting = sorting;
else
this.pricesorting = ;
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.products[i]['newPrice'][0]['newPrice'] <= this.toPrice)
this.pricesorting.push(this.products[i])
else if (this.toPrice == 0)
this.pricesorting = ;
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice)
this.pricesorting.push(this.products[i])
console.log(this.pricesorting)
// #################### Shorting Ending price ############################
endPrice(event: any)
this.toPrice = event;
if (this.fromPrice > 0 && this.toPrice == 0)
var sorting =
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice)
sorting.push(this.products[i]);
this.pricesorting = sorting;
else if (this.fromPrice == 0 && this.toPrice == 0)
this.pricesorting = this.products
else if (this.ml != 0)
var sorting =
for (let i = 0; i < this.sortingdata.length; i++)
if (this.sortingdata[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.sortingdata[i]['newPrice'][0]['newPrice'] <= this.toPrice)
sorting.push(this.sortingdata[i]);
this.pricesorting = sorting;
else
this.pricesorting =
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.products[i]['newPrice'][0]['newPrice'] <= this.toPrice)
this.pricesorting.push(this.products[i])
this.buttondata = this.pricesorting;
// console.log(this.pricesorting)
products.component.html
<mat-sidenav-container>
<mat-sidenav #sidenav [opened]="sidenavOpen" [mode]="sidenavOpen ? 'side' : 'over'" class="filter-sidenav"
perfectScrollbar>
<mat-accordion displayMode="flat" multi="true">
<!-------------------- Price range ---------------------->
<app-price-filter></app-price-filter>
<!-------------------- Price range ends ---------------------->
</mat-accordion>
</mat-sidenav>
<mat-sidenav-content class="all-products" ngClass.gt-sm="p-left">
<div *ngIf="pricesorting.length == 0">
<h1 class="py-1 text-muted lh" style=" text-align: center;"> No Result Found .</h1>
</div>
<div *ngIf="pricesorting.length != 0">
<div *ngIf="viewType == 'grid'" fxLayout="row wrap" class="products-wrapper">
<div *ngFor="let product of pricesorting | paginate: itemsPerPage: count, currentPage: page " fxFlex="100"
[fxFlex.gt-sm]="viewCol" fxFlex.sm="50" class="col">
<mat-card class="product-item text-center hover-border">
<mat-chip-list *ngIf="product.discount != 0">
<mat-chip color="warn" selected="true">product.discount% OFF</mat-chip>
</mat-chip-list>
<a [routerLink]="['/products/single', product.productId]" class="image-link">
<img [src]="imageHost + product.images[0].medium" alt="">
</a>
<h4 class="category text-muted"> filterById :
product.categoryId )?.name </h4>
<a [routerLink]="['/products/single', product.productId]" class="title text-truncate">
product.name
</a>
<div fxLayout="row" fxLayoutAlign="space-between center" class="prices">
<div fxLayout="column" fxLayoutAlign="center start">
<!-- <p class="old-price text-muted"><span *ngIf="product.oldPrice">$ number : '1.2-2'</span></p> -->
<p class="new-price">$product.newPrice[0].newPrice </p>
</div>
<app-rating [ratingsCount]="product.ratingsCount" [ratingsValue]="product.ratingsValue"
[direction]="'column'"></app-rating>
</div>
<div class="divider mt-2"></div>
<div class="icons">
<app-controls [product]="product" (onOpenProductDialog)="openProductDialog(product)"></app-controls>
</div>
</mat-card>
</div>
</div>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
in this component i am able to get the products based on price sorting in console am getting it.
i want to pass this this.pricesorting
to products.component.html so please tell me how to do this
angular angularjs-directive angular6
Here i am using two component
1) product-filter.component (sorting product based on price)
2) products.component (all product page)
product-filter.component.html
<mat-expansion-panel expanded>
<mat-expansion-panel-header>
<mat-panel-title>
<h4>Price</h4>
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="row" fxLayoutAlign="space-between center" class="text-muted">
<span>From: <b>$matslider1.value</b></span>
<span>To: <b>$matslider2.value</b></span>
</div>
<div fxLayout="row" fxLayoutAlign="space-between center" class="filter-price">
<mat-slider color="primary" min="0" max="500" step="10" #matslider1 (input)="startPrice($event.value)"></mat-slider>
<mat-slider color="warn" min="0" max="1000" step="10" #matslider2 (input)="endPrice($event.value)"></mat-slider>
</div>
</mat-expansion-panel>
product-filter.component.ts
// #################### Shorting Start price ############################
startPrice(event: any)
this.fromPrice = event;
if (this.fromPrice == 0 && this.toPrice == 0)
this.pricesorting = this.products
else if (this.toPrice != 0)
if (this.ml != 0)
var sorting = ;
for (let i = 0; i < this.sortingdata.length; i++)
if (this.sortingdata[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.sortingdata[i]['newPrice'][0]['newPrice'] <= this.toPrice)
sorting.push(this.pricesorting[i]);
this.pricesorting = sorting;
else
this.pricesorting = ;
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.products[i]['newPrice'][0]['newPrice'] <= this.toPrice)
this.pricesorting.push(this.products[i])
else if (this.toPrice == 0)
this.pricesorting = ;
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice)
this.pricesorting.push(this.products[i])
console.log(this.pricesorting)
// #################### Shorting Ending price ############################
endPrice(event: any)
this.toPrice = event;
if (this.fromPrice > 0 && this.toPrice == 0)
var sorting =
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice)
sorting.push(this.products[i]);
this.pricesorting = sorting;
else if (this.fromPrice == 0 && this.toPrice == 0)
this.pricesorting = this.products
else if (this.ml != 0)
var sorting =
for (let i = 0; i < this.sortingdata.length; i++)
if (this.sortingdata[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.sortingdata[i]['newPrice'][0]['newPrice'] <= this.toPrice)
sorting.push(this.sortingdata[i]);
this.pricesorting = sorting;
else
this.pricesorting =
for (let i = 0; i < this.products.length; i++)
if (this.products[i]['newPrice'][0]['newPrice'] >= this.fromPrice && this.products[i]['newPrice'][0]['newPrice'] <= this.toPrice)
this.pricesorting.push(this.products[i])
this.buttondata = this.pricesorting;
// console.log(this.pricesorting)
products.component.html
<mat-sidenav-container>
<mat-sidenav #sidenav [opened]="sidenavOpen" [mode]="sidenavOpen ? 'side' : 'over'" class="filter-sidenav"
perfectScrollbar>
<mat-accordion displayMode="flat" multi="true">
<!-------------------- Price range ---------------------->
<app-price-filter></app-price-filter>
<!-------------------- Price range ends ---------------------->
</mat-accordion>
</mat-sidenav>
<mat-sidenav-content class="all-products" ngClass.gt-sm="p-left">
<div *ngIf="pricesorting.length == 0">
<h1 class="py-1 text-muted lh" style=" text-align: center;"> No Result Found .</h1>
</div>
<div *ngIf="pricesorting.length != 0">
<div *ngIf="viewType == 'grid'" fxLayout="row wrap" class="products-wrapper">
<div *ngFor="let product of pricesorting | paginate: itemsPerPage: count, currentPage: page " fxFlex="100"
[fxFlex.gt-sm]="viewCol" fxFlex.sm="50" class="col">
<mat-card class="product-item text-center hover-border">
<mat-chip-list *ngIf="product.discount != 0">
<mat-chip color="warn" selected="true">product.discount% OFF</mat-chip>
</mat-chip-list>
<a [routerLink]="['/products/single', product.productId]" class="image-link">
<img [src]="imageHost + product.images[0].medium" alt="">
</a>
<h4 class="category text-muted"> filterById :
product.categoryId )?.name </h4>
<a [routerLink]="['/products/single', product.productId]" class="title text-truncate">
product.name
</a>
<div fxLayout="row" fxLayoutAlign="space-between center" class="prices">
<div fxLayout="column" fxLayoutAlign="center start">
<!-- <p class="old-price text-muted"><span *ngIf="product.oldPrice">$ number : '1.2-2'</span></p> -->
<p class="new-price">$product.newPrice[0].newPrice </p>
</div>
<app-rating [ratingsCount]="product.ratingsCount" [ratingsValue]="product.ratingsValue"
[direction]="'column'"></app-rating>
</div>
<div class="divider mt-2"></div>
<div class="icons">
<app-controls [product]="product" (onOpenProductDialog)="openProductDialog(product)"></app-controls>
</div>
</mat-card>
</div>
</div>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
in this component i am able to get the products based on price sorting in console am getting it.
i want to pass this this.pricesorting
to products.component.html so please tell me how to do this
angular angularjs-directive angular6
angular angularjs-directive angular6
asked Nov 10 at 6:00
Sudharsan Venkatraj
548
548
did you try router???
– Alireza Khajavi
Nov 10 at 6:05
have you triedshared services
?
– CruelEngine
Nov 10 at 6:57
add a comment |
did you try router???
– Alireza Khajavi
Nov 10 at 6:05
have you triedshared services
?
– CruelEngine
Nov 10 at 6:57
did you try router???
– Alireza Khajavi
Nov 10 at 6:05
did you try router???
– Alireza Khajavi
Nov 10 at 6:05
have you tried
shared services
?– CruelEngine
Nov 10 at 6:57
have you tried
shared services
?– CruelEngine
Nov 10 at 6:57
add a comment |
1 Answer
1
active
oldest
votes
In product-filter.component.ts, you can emit an event using Event.Emitter().
public priceData = new EventEmitter<any>(null);
this.priceData.emit(this.pricesorting);
products.component.html
<app-price-filter (priceData)="handlePriceData($event)"></app-price-filter>
products.component.ts
handlePriceData(price)
console.log(price);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236402%2fhow-to-pass-data-with-out-using-selector-in-angular-6%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In product-filter.component.ts, you can emit an event using Event.Emitter().
public priceData = new EventEmitter<any>(null);
this.priceData.emit(this.pricesorting);
products.component.html
<app-price-filter (priceData)="handlePriceData($event)"></app-price-filter>
products.component.ts
handlePriceData(price)
console.log(price);
add a comment |
In product-filter.component.ts, you can emit an event using Event.Emitter().
public priceData = new EventEmitter<any>(null);
this.priceData.emit(this.pricesorting);
products.component.html
<app-price-filter (priceData)="handlePriceData($event)"></app-price-filter>
products.component.ts
handlePriceData(price)
console.log(price);
add a comment |
In product-filter.component.ts, you can emit an event using Event.Emitter().
public priceData = new EventEmitter<any>(null);
this.priceData.emit(this.pricesorting);
products.component.html
<app-price-filter (priceData)="handlePriceData($event)"></app-price-filter>
products.component.ts
handlePriceData(price)
console.log(price);
In product-filter.component.ts, you can emit an event using Event.Emitter().
public priceData = new EventEmitter<any>(null);
this.priceData.emit(this.pricesorting);
products.component.html
<app-price-filter (priceData)="handlePriceData($event)"></app-price-filter>
products.component.ts
handlePriceData(price)
console.log(price);
answered Nov 10 at 6:08
Suresh Kumar Ariya
4,4131215
4,4131215
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236402%2fhow-to-pass-data-with-out-using-selector-in-angular-6%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you try router???
– Alireza Khajavi
Nov 10 at 6:05
have you tried
shared services
?– CruelEngine
Nov 10 at 6:57