I am facing an issue with my two simple services that should both return results from a REST API.
Initially, I started with using Promises but encountered a problem where toPromise()
was not found, similar to the issue discussed here.
Then, I attempted to switch to Observables. However, I faced a similar problem where map()
could not be found.
Here is a snippet of the code...
// Package.json
{
"name": "mvc-angular-2",
...
}
// Typings.json
{
...
}
// Tsconfig.json
{
...
}
// systemjs.config.js
...
})(this);
// Main.ts
...
// App.component.ts
...
// Users.component.ts
...
// User.service.ts (Promise)
...
// Privilege.service.ts (Observable)
...
Lastly:
npm -v
: 3.10.3node -v
: v6.3.0- Visual Studio 2015 Update 3
I have tried deleting the node_modules
folder and rebuilding it, but to no avail.
I also attempted to build it outside Visual Studio by running a command like npm run tsc --rootDir .\app
, which resulted in the following output:
...
Subsequently, I realized there was no file named app.ts
. So, I instructed it to transpile a folder instead. Here is the file structure overview:
D:\projects\MVCAngular2\src\Client\
...\app\...
...\gulpfile.js
...\node_modules\[14.536 node_modules files]
...\package.json
...\Program.cs
...\Startup.cs
...\typings\...
...\web.config
...\wwwroot\...
Upon finding this helpful example utilizing identical versions to mine, working smoothly by transpiling scripts in the browser, I am puzzled as to what might be causing the issue.
If you have any insights or solutions, please do share.
Thank you, Carsten