Skip to content

angular/cli 1.0.1 local JSON files #6158

@brife

Description

@brife

Bug Report or Feature Request (mark with an x)

- [ X] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.1
node: 6.10.0
os: darwin x64
@angular/animations: 4.1.0
@angular/common: 4.1.0
@angular/core: 4.1.0
@angular/forms: 4.1.0
@angular/http: 4.1.0
@angular/platform-browser: 4.1.0
@angular/platform-browser-dynamic: 4.1.0
@angular/router: 4.1.0
@angular/cli: 1.0.1
@angular/compiler-cli: 4.1.0
@angular/compiler: 4.1.0

Repro steps.

Up until @angular/cli 1.0.1, I was able to serve up test data from a local JSON file just by supplying the relative patch to the http component. For example, this.http.get(''/src/app/testdata/sopData.json'').map(...), would happily serve up the JSON from the root of the ng4 project. After upgrading to 1.0.1 this no longer works. I get a 404 on the http://localhost:4200/src/app/testdata/sopData.json request.

If I down grade to 1.0.0 it serves up the fine without error. I never really understood how not specifying a server translated to a straight file operation but I did take advantage of it. The fact that it doesn't work anymore doesn't feel like a bug, it feels more like a loophole that's been closed.

The log given by the failure.

GET http://localhost:4200/src/app/testdata/sopData.json 404 (Not Found)
scheduleTask
ZoneDelegate.scheduleTask
onScheduleTask
ZoneDelegate.scheduleTask
Zone.scheduleTask
Zone.scheduleMacroTask
(anonymous function)
send
(anonymous function)
Observable._trySubscribe
Observable.subscribe
MapOperator.call
Observable.subscribe
webpackJsonp.51.BaseSopPanelComponent.fetchData
webpackJsonp.51.BaseSopPanelComponent.ngOnInit
checkAndUpdateDirectiveInline
checkAndUpdateNodeInline
checkAndUpdateNode
debugCheckAndUpdateNode
debugCheckDirectivesFn
(anonymous function)
debugUpdateDirectives
checkAndUpdateView
callViewAction
execComponentViewsAction

Desired functionality.

Mention any other details that might be useful.

Metadata

Metadata

Assignees

Labels

needs: repro stepsWe cannot reproduce the issue with the information given

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions