Skip to content

trying to use rxjs - getting vendor/rxjs/index.js 404 (Not Found) in browser #730

Closed
@alvipeo

Description

@alvipeo

Added to my prj jquery, bootstrap 4, other things and got it working (except for tests - a separate issue). Now, trying to add some state which uses rxjs (Observables, etc) and now getting in a browser (in Chrome, when 'ng serve'):

zone.js:101 GET http://localhost:4200/vendor/rxjs/index.js 404 (Not Found)

Why is it looking for rxjs/index.js ???

Here's now I added it - folder structure first:

  • app
    • shared
      -models added
      • news.model.ts - simple class for model
      • index.ts - (export * from "./news.model";)
  • state added
    • appState.ts - contains actual code that uses rxjs
    • index.ts - (export * from "./appState";)

and then I just use it in my main component - with import from ... and DI.

Example code for appState.ts:

import { Observable, BehaviorSubject } from "rxjs";
import { NewsItem } from "../models";

export interface AppState {
    news: NewsItem[];
}

export class AddNewsAction {
    constructor(public newItem: NewsItem) { }
}

export type Action = AddNewsAction;

export function stateFn(initState: AppState, actions: Observable<Action>): Observable<AppState> {
    const combine = s => ({ news: s[0] });
    const appStateObs: Observable<AppState> = allState(initState.news, actions)
        .map(combine);

    return wrapIntoBehavior(initState, appStateObs);
}

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions