Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while adding #3

Closed
atmohsin opened this issue Feb 26, 2018 · 5 comments
Closed

Error while adding #3

atmohsin opened this issue Feb 26, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@atmohsin
Copy link

atmohsin commented Feb 26, 2018

ERROR TypeError: Cannot read property 'name' of undefined
at eval (user.component.ts:174)
at Array.filter ()
at MapSubscriber.eval [as project] (user.component.ts:172)
at MapSubscriber._next (map.js:79)
at MapSubscriber.Subscriber.next (Subscriber.js:92)
at MergeMapSubscriber.notifyNext (mergeMap.js:151)
at InnerSubscriber._next (InnerSubscriber.js:25)
at InnerSubscriber.Subscriber.next (Subscriber.js:92)
at BehaviorSubject.Subject.next (Subject.js:56)
at BehaviorSubject.next (BehaviorSubject.js:46)

This error occure when assigning the dialogData with the object which we got it from form.
this.dialogData = userObj;

if we put before post request in Service class it is working, But id and created_at and update_at are emty, In my case ID is auto increament and created_at and update_at are set to default value current date. So user wont supply it from the front end. Once the user object persisted in to the data base. These value id,created_at and update_dt are should assign to the front end list.

Please suggest how we can overcome this.

Thanks
Mohsin

@marinantonio
Copy link
Owner

You might want to check out this or other samples how to retrieve current date/time:
http://embed.plnkr.co/1DtJB6nAAYp9ZXOcfP6P/

In my projects backend generates date and time.

@marinantonio marinantonio added the bug Something isn't working label Feb 26, 2018
@atmohsin
Copy link
Author

dialogRef.afterClosed().subscribe(result => {
if (result === 1) {
// After dialog is closed we're doing frontend updates
// For add we're just pushing a new row inside DataService
setTimeout(() => {
this.exampleDatabase.dataChange.value.push(this.dataService.getDialogData());
this.refreshTable();
},2000);
}
});

I made some delay, so that the object get from API set it.

@marinantonio
Copy link
Owner

Does it works?

@atmohsin
Copy link
Author

Yes

@kishore96182
Copy link

Use below code it's working!!!

setTimeout(() => {
this.exampleDatabase.dataChange.value.push(this.dataService.getDialogData());
this.exampleDatabase.getAllIssues();
this.refreshTable();
}, 1500);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants