I wrote a script to call mat-dialog to allow user to quit without saving
onMatTabChange event..
It is a permissions & roles screen. Just concerned with objects(workflow &
reports) data.
I have the _objectsData variable with the backend data. I need to get the
current input from user
in the Treeview and compare the two. if there is a change then display the
warning dialog.
It works except the compare line:.
if (JSON.stringify(this._objectsData ) !== JSON.stringify(TreeviewItem)) {
if(event.index=== 0 || event.index === 2){
this.openQuit();
I can't figure out how to get this same object out of the TreeView service
call structure in order to compare????
I just don't understand how to get the res.json object. I am trying
TreeviewItem here but that is wrong. Thanks,
====================
onLinkClick(event: MatTabChangeEvent ) {
console.log('event => ', event);
console.log('index => ', event.index);
console.log('tab => ', event.tab);
this.rmService.getObjects().subscribe(res => {
console.log('Get Objects Results '+JSON.stringify(res));
res.map(item => {
if (item.type == "WORKFLOW") {
let treeviewItems = item.objects[0].objects[0].objects.map(object => {
const data = {
text: object.name,
value: object.id
};
return data;
});
this.objectItem.push(new TreeviewItem({
text: item.type,
value: 1,
collapsed: false,
children: [{
text: item.objects[0].type,
value: item.id,
children: [{
text: item.objects[0].objects[0].type,
value: item.id,
children: treeviewItems,
}],
}],
}));
}
if (item.type == "REPORTS") {
let treeviewItems = item.objects[0].objects.map(object => {
const data = {
text: object.name,
value: object.id
};
return data;
});
this.objectItem.push(new TreeviewItem({
text: item.type,
value: 0,
collapsed: false,
children: [{
text: item.objects[0].type,
value: item.id,
children: treeviewItems,
}],
}));
}
});
});
console.log("Objects Data "+this._objectsData);
console.log("Treeview Data "+TreeviewItem);
if (JSON.stringify(this._objectsData ) !== JSON.stringify(TreeviewItem)) {
if(event.index=== 0 || event.index === 2){
this.openQuit();
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
To view this discussion on the web visit
https://groups.google.com/d/msgid/angular/54c97b3b-9ded-4db2-ae3a-7be6c174ff96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.