angular: Live example is throwing a null pointer exception in javascript

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

I go to https://angular.io/generated/live-examples/toh-pt6/eplnkr.html for the live. I try to do anything and it is not responding. Also on load it throws a console log error. So this is to report two errors. I was just looking through the code and it looks like it is also supposed to be populated with heros.

Expected behavior

I should be able to add a hero. I tried two different browsers. No Luck. It doesn’t get populated with heros to start with.

Minimal reproduction of the problem with instructions

Pasted https://angular.io/generated/live-examples/toh-pt6/eplnkr.html in a browser. Click on Heroes and enter in a heros name then click on the add button. The name will disappear. I also noticed that on load it throws an error.

What is the motivation / use case for changing the behavior?

To have good documentation

Environment


Angular version: X.Y.Z
This is running on the plnkr.co I have no idea what version it is under.

Browser:
- [x] Chrome (desktop) version 61
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version 55
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:
how about both of the error messages:
INITIAL LOADING ERROR:
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'slice' of undefined
TypeError: Cannot read property 'slice' of undefined
    at eval (https://run.plnkr.co/preview/cj8glfx1h000r3c5scc0ie3qi/app/dashboard.component.ts!transpiled:22:68)
    at ZoneDelegate.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:242:26)
    at Object.onInvoke (https://unpkg.com/@angular/core/bundles/core.umd.js:3922:33)
    at ZoneDelegate.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:241:32)
    at Zone.run (https://unpkg.com/zone.js@0.7.4/dist/zone.js:113:43)
    at https://unpkg.com/zone.js@0.7.4/dist/zone.js:520:57
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:275:35)
    at Object.onInvokeTask (https://unpkg.com/@angular/core/bundles/core.umd.js:3913:33)
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:274:40)
    at Zone.runTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:151:47)
    at drainMicroTaskQueue (https://unpkg.com/zone.js@0.7.4/dist/zone.js:418:35)
    at ZoneTask.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:349:25)
    at data.args.(anonymous function) (https://unpkg.com/zone.js@0.7.4/dist/zone.js:1224:25)
    at eval (https://run.plnkr.co/preview/cj8glfx1h000r3c5scc0ie3qi/app/dashboard.component.ts!transpiled:22:68)
    at ZoneDelegate.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:242:26)
    at Object.onInvoke (https://unpkg.com/@angular/core/bundles/core.umd.js:3922:33)
    at ZoneDelegate.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:241:32)
    at Zone.run (https://unpkg.com/zone.js@0.7.4/dist/zone.js:113:43)
    at https://unpkg.com/zone.js@0.7.4/dist/zone.js:520:57
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:275:35)
    at Object.onInvokeTask (https://unpkg.com/@angular/core/bundles/core.umd.js:3913:33)
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:274:40)
    at Zone.runTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:151:47)
    at drainMicroTaskQueue (https://unpkg.com/zone.js@0.7.4/dist/zone.js:418:35)
    at ZoneTask.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:349:25)
    at data.args.(anonymous function) (https://unpkg.com/zone.js@0.7.4/dist/zone.js:1224:25)
    at resolvePromise (https://unpkg.com/zone.js@0.7.4/dist/zone.js:486:31) [angular]
    at https://unpkg.com/zone.js@0.7.4/dist/zone.js:523:17 [angular]
    at Object.onInvokeTask (https://unpkg.com/@angular/core/bundles/core.umd.js:3913:33) [angular]
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:274:40) [angular]
    at Zone.runTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:151:47) [<root> => angular]
    at drainMicroTaskQueue (https://unpkg.com/zone.js@0.7.4/dist/zone.js:418:35) [<root>]
    at ZoneTask.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:349:25) [<root>]
    at data.args.(anonymous function) (https://unpkg.com/zone.js@0.7.4/dist/zone.js:1224:25) [<root>]

ADD HERO ERROR:
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'push' of undefined
TypeError: Cannot read property 'push' of undefined
    at eval (https://run.plnkr.co/preview/cj8glfx1h000r3c5scc0ie3qi/app/heroes.component.ts!transpiled:34:26)
    at ZoneDelegate.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:242:26)
    at Object.onInvoke (https://unpkg.com/@angular/core/bundles/core.umd.js:3922:33)
    at ZoneDelegate.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:241:32)
    at Zone.run (https://unpkg.com/zone.js@0.7.4/dist/zone.js:113:43)
    at https://unpkg.com/zone.js@0.7.4/dist/zone.js:520:57
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:275:35)
    at Object.onInvokeTask (https://unpkg.com/@angular/core/bundles/core.umd.js:3913:33)
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:274:40)
    at Zone.runTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:151:47)
    at drainMicroTaskQueue (https://unpkg.com/zone.js@0.7.4/dist/zone.js:418:35)
    at ZoneTask.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:349:25)
    at data.args.(anonymous function) (https://unpkg.com/zone.js@0.7.4/dist/zone.js:1224:25)
    at eval (https://run.plnkr.co/preview/cj8glfx1h000r3c5scc0ie3qi/app/heroes.component.ts!transpiled:34:26)
    at ZoneDelegate.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:242:26)
    at Object.onInvoke (https://unpkg.com/@angular/core/bundles/core.umd.js:3922:33)
    at ZoneDelegate.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:241:32)
    at Zone.run (https://unpkg.com/zone.js@0.7.4/dist/zone.js:113:43)
    at https://unpkg.com/zone.js@0.7.4/dist/zone.js:520:57
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:275:35)
    at Object.onInvokeTask (https://unpkg.com/@angular/core/bundles/core.umd.js:3913:33)
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:274:40)
    at Zone.runTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:151:47)
    at drainMicroTaskQueue (https://unpkg.com/zone.js@0.7.4/dist/zone.js:418:35)
    at ZoneTask.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:349:25)
    at data.args.(anonymous function) (https://unpkg.com/zone.js@0.7.4/dist/zone.js:1224:25)
    at resolvePromise (https://unpkg.com/zone.js@0.7.4/dist/zone.js:486:31) [angular]
    at https://unpkg.com/zone.js@0.7.4/dist/zone.js:523:17 [angular]
    at Object.onInvokeTask (https://unpkg.com/@angular/core/bundles/core.umd.js:3913:33) [angular]
    at ZoneDelegate.invokeTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:274:40) [angular]
    at Zone.runTask (https://unpkg.com/zone.js@0.7.4/dist/zone.js:151:47) [<root> => angular]
    at drainMicroTaskQueue (https://unpkg.com/zone.js@0.7.4/dist/zone.js:418:35) [<root>]
    at ZoneTask.invoke (https://unpkg.com/zone.js@0.7.4/dist/zone.js:349:25) [<root>]
    at data.args.(anonymous function) (https://unpkg.com/zone.js@0.7.4/dist/zone.js:1224:25) [<root>]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 15 (5 by maintainers)

Most upvoted comments

It seems that in HeroService there are some occurrences of .then(response => response.json().data) which should actually be .then(response => response.json()).

@wardbell, any idea what is going on here? Is this related to the recent angular-in-memory-web-api update?