Angular 6 - View of child component do not updating
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
i have two components , in the first one i have an array input
the first component is :
@Input('data')
set ungroupedData(ungroupedData: any) {
this._ungroupedData = null;
this.groupedData = ;
this._ungroupedData = ungroupedData;
this.columnManager = ;
this.cdr.detectChanges();
if (ungroupedData) {
this.jsonKeys = Object.keys(this.ungroupedData[0]);
let groupBy: string = this.jsonKeys[0] ? this.jsonKeys[0] : "";
if (this.groupingColumn && this.groupingColumn.length > 0) {
groupBy = this.groupingColumn;
}
this.groupedData = this.groupStructural(groupBy, this.ungroupedData);
this.groupKeys = Object.keys(this.groupedData);
// Fill columnContainer
for (var groupKey of this.groupKeys) {
var x: ColumnContainer = new ColumnContainer();
x.add([{
jsonKey: this.displayColumn,
name: groupKey,
width: 90,
type: EColumnType.text,
clickable: EColumnClickable.clickable,
routerURL: '/bulletin-officiel/access-chronologique/detail/',
routerKey: 'tid',
sortable: false,
order: 0
},
{
jsonKey: "pdf",
name: "PDF",
width: 10,
type: EColumnType.icon,
clickable: EColumnClickable.clickable,
imageURL: "/assets/projets/images/pdf.png",
sortable: false,
order: 1
}]);
this.columnManager.push(x);
}
} else {
this._ungroupedData = null;
}
this.cdr.detectChanges();
}
@Input('groupBy') groupingColumn: string;
@Input('display') displayColumn: string;
private _groupedData: any;
public get groupedData() {
return this._groupedData
};
public set groupedData(newData: any) {
this._groupedData = ;
this.cdr.detectChanges();
this._groupedData = newData;
}
public jsonKeys: string;
public groupKeys: string;
private columnManager: ColumnContainer;
constructor(private cdr: ChangeDetectorRef) {
this.columnManager = ;
}
In the view of the second component i call the first one and passe the data to it like so .
<app-dynamic-tree [data]="data" groupBy="label" display="ttitreLFr"></app-dynamic-tree>
<div style="position: fixed; top: 50%; right: 50%">
<ngx-spinner bdColor="trasparent"
size="medium"
color="#2288bd"
type="ball-clip-rotate"></ngx-spinner>
</div>
The Api was called, but the view of the first component do not update.I don't know what exactly the source of the problem .
i wonder if there is some solution?
thanks a lot.
|
show 2 more comments
i have two components , in the first one i have an array input
the first component is :
@Input('data')
set ungroupedData(ungroupedData: any) {
this._ungroupedData = null;
this.groupedData = ;
this._ungroupedData = ungroupedData;
this.columnManager = ;
this.cdr.detectChanges();
if (ungroupedData) {
this.jsonKeys = Object.keys(this.ungroupedData[0]);
let groupBy: string = this.jsonKeys[0] ? this.jsonKeys[0] : "";
if (this.groupingColumn && this.groupingColumn.length > 0) {
groupBy = this.groupingColumn;
}
this.groupedData = this.groupStructural(groupBy, this.ungroupedData);
this.groupKeys = Object.keys(this.groupedData);
// Fill columnContainer
for (var groupKey of this.groupKeys) {
var x: ColumnContainer = new ColumnContainer();
x.add([{
jsonKey: this.displayColumn,
name: groupKey,
width: 90,
type: EColumnType.text,
clickable: EColumnClickable.clickable,
routerURL: '/bulletin-officiel/access-chronologique/detail/',
routerKey: 'tid',
sortable: false,
order: 0
},
{
jsonKey: "pdf",
name: "PDF",
width: 10,
type: EColumnType.icon,
clickable: EColumnClickable.clickable,
imageURL: "/assets/projets/images/pdf.png",
sortable: false,
order: 1
}]);
this.columnManager.push(x);
}
} else {
this._ungroupedData = null;
}
this.cdr.detectChanges();
}
@Input('groupBy') groupingColumn: string;
@Input('display') displayColumn: string;
private _groupedData: any;
public get groupedData() {
return this._groupedData
};
public set groupedData(newData: any) {
this._groupedData = ;
this.cdr.detectChanges();
this._groupedData = newData;
}
public jsonKeys: string;
public groupKeys: string;
private columnManager: ColumnContainer;
constructor(private cdr: ChangeDetectorRef) {
this.columnManager = ;
}
In the view of the second component i call the first one and passe the data to it like so .
<app-dynamic-tree [data]="data" groupBy="label" display="ttitreLFr"></app-dynamic-tree>
<div style="position: fixed; top: 50%; right: 50%">
<ngx-spinner bdColor="trasparent"
size="medium"
color="#2288bd"
type="ball-clip-rotate"></ngx-spinner>
</div>
The Api was called, but the view of the first component do not update.I don't know what exactly the source of the problem .
i wonder if there is some solution?
thanks a lot.
add html template of the first component and typescript of the second component, or ideally create stackblitz.com demo.
– Ludevik
Nov 16 '18 at 17:00
Thanks you , @Ludevik here is the link of the code you ask . code of first component
– Moum
Nov 16 '18 at 17:19
creating stackblitz demo doesn't mean to just copy the code there. Create working demo that demonstrates your problem.
– Ludevik
Nov 17 '18 at 23:00
you are right @Ludevik , but the demo do not work because the component in witch i have problems need more ones to work as good demo.
– Moum
Nov 18 '18 at 15:59
[code of two components ](stackblitz.com/edit/…)
– Moum
Nov 18 '18 at 16:05
|
show 2 more comments
i have two components , in the first one i have an array input
the first component is :
@Input('data')
set ungroupedData(ungroupedData: any) {
this._ungroupedData = null;
this.groupedData = ;
this._ungroupedData = ungroupedData;
this.columnManager = ;
this.cdr.detectChanges();
if (ungroupedData) {
this.jsonKeys = Object.keys(this.ungroupedData[0]);
let groupBy: string = this.jsonKeys[0] ? this.jsonKeys[0] : "";
if (this.groupingColumn && this.groupingColumn.length > 0) {
groupBy = this.groupingColumn;
}
this.groupedData = this.groupStructural(groupBy, this.ungroupedData);
this.groupKeys = Object.keys(this.groupedData);
// Fill columnContainer
for (var groupKey of this.groupKeys) {
var x: ColumnContainer = new ColumnContainer();
x.add([{
jsonKey: this.displayColumn,
name: groupKey,
width: 90,
type: EColumnType.text,
clickable: EColumnClickable.clickable,
routerURL: '/bulletin-officiel/access-chronologique/detail/',
routerKey: 'tid',
sortable: false,
order: 0
},
{
jsonKey: "pdf",
name: "PDF",
width: 10,
type: EColumnType.icon,
clickable: EColumnClickable.clickable,
imageURL: "/assets/projets/images/pdf.png",
sortable: false,
order: 1
}]);
this.columnManager.push(x);
}
} else {
this._ungroupedData = null;
}
this.cdr.detectChanges();
}
@Input('groupBy') groupingColumn: string;
@Input('display') displayColumn: string;
private _groupedData: any;
public get groupedData() {
return this._groupedData
};
public set groupedData(newData: any) {
this._groupedData = ;
this.cdr.detectChanges();
this._groupedData = newData;
}
public jsonKeys: string;
public groupKeys: string;
private columnManager: ColumnContainer;
constructor(private cdr: ChangeDetectorRef) {
this.columnManager = ;
}
In the view of the second component i call the first one and passe the data to it like so .
<app-dynamic-tree [data]="data" groupBy="label" display="ttitreLFr"></app-dynamic-tree>
<div style="position: fixed; top: 50%; right: 50%">
<ngx-spinner bdColor="trasparent"
size="medium"
color="#2288bd"
type="ball-clip-rotate"></ngx-spinner>
</div>
The Api was called, but the view of the first component do not update.I don't know what exactly the source of the problem .
i wonder if there is some solution?
thanks a lot.
i have two components , in the first one i have an array input
the first component is :
@Input('data')
set ungroupedData(ungroupedData: any) {
this._ungroupedData = null;
this.groupedData = ;
this._ungroupedData = ungroupedData;
this.columnManager = ;
this.cdr.detectChanges();
if (ungroupedData) {
this.jsonKeys = Object.keys(this.ungroupedData[0]);
let groupBy: string = this.jsonKeys[0] ? this.jsonKeys[0] : "";
if (this.groupingColumn && this.groupingColumn.length > 0) {
groupBy = this.groupingColumn;
}
this.groupedData = this.groupStructural(groupBy, this.ungroupedData);
this.groupKeys = Object.keys(this.groupedData);
// Fill columnContainer
for (var groupKey of this.groupKeys) {
var x: ColumnContainer = new ColumnContainer();
x.add([{
jsonKey: this.displayColumn,
name: groupKey,
width: 90,
type: EColumnType.text,
clickable: EColumnClickable.clickable,
routerURL: '/bulletin-officiel/access-chronologique/detail/',
routerKey: 'tid',
sortable: false,
order: 0
},
{
jsonKey: "pdf",
name: "PDF",
width: 10,
type: EColumnType.icon,
clickable: EColumnClickable.clickable,
imageURL: "/assets/projets/images/pdf.png",
sortable: false,
order: 1
}]);
this.columnManager.push(x);
}
} else {
this._ungroupedData = null;
}
this.cdr.detectChanges();
}
@Input('groupBy') groupingColumn: string;
@Input('display') displayColumn: string;
private _groupedData: any;
public get groupedData() {
return this._groupedData
};
public set groupedData(newData: any) {
this._groupedData = ;
this.cdr.detectChanges();
this._groupedData = newData;
}
public jsonKeys: string;
public groupKeys: string;
private columnManager: ColumnContainer;
constructor(private cdr: ChangeDetectorRef) {
this.columnManager = ;
}
In the view of the second component i call the first one and passe the data to it like so .
<app-dynamic-tree [data]="data" groupBy="label" display="ttitreLFr"></app-dynamic-tree>
<div style="position: fixed; top: 50%; right: 50%">
<ngx-spinner bdColor="trasparent"
size="medium"
color="#2288bd"
type="ball-clip-rotate"></ngx-spinner>
</div>
The Api was called, but the view of the first component do not update.I don't know what exactly the source of the problem .
i wonder if there is some solution?
thanks a lot.
asked Nov 16 '18 at 15:40
MoumMoum
186
186
add html template of the first component and typescript of the second component, or ideally create stackblitz.com demo.
– Ludevik
Nov 16 '18 at 17:00
Thanks you , @Ludevik here is the link of the code you ask . code of first component
– Moum
Nov 16 '18 at 17:19
creating stackblitz demo doesn't mean to just copy the code there. Create working demo that demonstrates your problem.
– Ludevik
Nov 17 '18 at 23:00
you are right @Ludevik , but the demo do not work because the component in witch i have problems need more ones to work as good demo.
– Moum
Nov 18 '18 at 15:59
[code of two components ](stackblitz.com/edit/…)
– Moum
Nov 18 '18 at 16:05
|
show 2 more comments
add html template of the first component and typescript of the second component, or ideally create stackblitz.com demo.
– Ludevik
Nov 16 '18 at 17:00
Thanks you , @Ludevik here is the link of the code you ask . code of first component
– Moum
Nov 16 '18 at 17:19
creating stackblitz demo doesn't mean to just copy the code there. Create working demo that demonstrates your problem.
– Ludevik
Nov 17 '18 at 23:00
you are right @Ludevik , but the demo do not work because the component in witch i have problems need more ones to work as good demo.
– Moum
Nov 18 '18 at 15:59
[code of two components ](stackblitz.com/edit/…)
– Moum
Nov 18 '18 at 16:05
add html template of the first component and typescript of the second component, or ideally create stackblitz.com demo.
– Ludevik
Nov 16 '18 at 17:00
add html template of the first component and typescript of the second component, or ideally create stackblitz.com demo.
– Ludevik
Nov 16 '18 at 17:00
Thanks you , @Ludevik here is the link of the code you ask . code of first component
– Moum
Nov 16 '18 at 17:19
Thanks you , @Ludevik here is the link of the code you ask . code of first component
– Moum
Nov 16 '18 at 17:19
creating stackblitz demo doesn't mean to just copy the code there. Create working demo that demonstrates your problem.
– Ludevik
Nov 17 '18 at 23:00
creating stackblitz demo doesn't mean to just copy the code there. Create working demo that demonstrates your problem.
– Ludevik
Nov 17 '18 at 23:00
you are right @Ludevik , but the demo do not work because the component in witch i have problems need more ones to work as good demo.
– Moum
Nov 18 '18 at 15:59
you are right @Ludevik , but the demo do not work because the component in witch i have problems need more ones to work as good demo.
– Moum
Nov 18 '18 at 15:59
[code of two components ](stackblitz.com/edit/…)
– Moum
Nov 18 '18 at 16:05
[code of two components ](stackblitz.com/edit/…)
– Moum
Nov 18 '18 at 16:05
|
show 2 more comments
0
active
oldest
votes
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%2f53341070%2fangular-6-view-of-child-component-do-not-updating%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2f53341070%2fangular-6-view-of-child-component-do-not-updating%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
add html template of the first component and typescript of the second component, or ideally create stackblitz.com demo.
– Ludevik
Nov 16 '18 at 17:00
Thanks you , @Ludevik here is the link of the code you ask . code of first component
– Moum
Nov 16 '18 at 17:19
creating stackblitz demo doesn't mean to just copy the code there. Create working demo that demonstrates your problem.
– Ludevik
Nov 17 '18 at 23:00
you are right @Ludevik , but the demo do not work because the component in witch i have problems need more ones to work as good demo.
– Moum
Nov 18 '18 at 15:59
[code of two components ](stackblitz.com/edit/…)
– Moum
Nov 18 '18 at 16:05