Currently, I am in the process of learning Angular4 and facing challenges with getting linqts to function properly.
Within my room-list.component.ts
file, I include it in this manner:
import { List } from 'linqts';
A few lines below, I have my component class structured like this:
export class RoomListComponent
{
public Rooms: List<Room>;
Although this setup is working fine. The value of Rooms
is assigned through other code returned from a signalR request like so:
this._roomService.GetListResult.subscribe((rooms: List<Room>) =>
{
this.Rooms = rooms;
});
So, I presume that List
is functioning correctly (as I swapped out all instances of Rooms: Room[]
with Rooms: List<Room>
). However, when attempting any operations like this (Whether it's Select
, Where
, etc.), nothing seems to work:
Rooms.Add(...
An error message appears stating something along the lines of
errors.ts:42 ERROR TypeError: _this.Rooms.Add is not a function
. In fact, things get chaos if I try something as simple as this (taken directly from the primary examples of linqts):
let arr = new List<number>([1, 2, 3, 4, 5]);
All of a sudden, two errors are thrown:
zone.js:1057 GET http://localhost:56040/Angular/linqts 404 (Not Found)
and
Unhandled Promise rejection: Fetch error: 404 Not Found Instantiating http://localhost:56040/Angular/linqts Loading http://localhost:56040/Angular/Appjs/components/room/room-list.component.js Loading app ; Zone: <root> ; Task: Promise.then ; Value: Error: Fetch error: 404 Not Found Instantiating http://localhost:56040/Angular/linqts Loading http://localhost:56040/Angular/Appjs/components/room/room-list.component.js Loading app at fetch.js:37 at ZoneDelegate.invoke (zone.js:392) at Zone.run (zone.js:142) at zone.js:873 at ZoneDelegate.invokeTask (zone.js:425) at Zone.runTask (zone.js:192) at drainMicroTaskQueue (zone.js:602) at <anonymous> Error: Fetch error: 404 Not Found at http://localhost:56040/Angular/node_modules/systemjs/dist/system.src.js:1475:13 at ZoneDelegate.invoke (http://localhost:56040/Angular/node_modules/zone.js/dist/zone.js:392:26) at Zone.run (http://localhost:56040/Angular/node_modules/zone.js/dist/zone.js:142:43) at http://localhost:56040/Angular/node_modules/zone.js/dist/zone.js:873:57 at ZoneDelegate.invokeTask (http://localhost:56040/Angular/node_modules/zone.js/dist/zone.js:425:31) at Zone.runTask (http://localhost:56040/Angular/node_modules/zone.js/dist/zone.js:192:47) at drainMicroTaskQueue (http://localhost:56040/Angular/node_modules/zone.js/dist/zone.js:602:35) at <anonymous>
What could be causing these issues?
I also attempted to search for any problems related to linqts online, but it seems unlikely that it is the source of the issue. It appears more likely that the functions cannot be found for some reason (despite successfully navigating with F12 in VS2017). My guess would then be that it was imported incorrectly, but how can I confirm? Another assumption was that it wasn't imported at all, but the code wouldn't compile without the import
statement, so this assumption may also be incorrect.