Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Using the client in Angular #41

Open
falk-stefan opened this issue May 28, 2022 · 0 comments
Open

[Question] Using the client in Angular #41

falk-stefan opened this issue May 28, 2022 · 0 comments

Comments

@falk-stefan
Copy link

falk-stefan commented May 28, 2022

Hi!

I am currently tying to use the generated client inside my Angular web app.

However, the issue I am facing is that I am unable to correctly load/import the generated code.

Idk if anybody can help me on this but essentially the error is

core.mjs:6494 ERROR TypeError: (0 , ogdrisservice__WEBPACK_IMPORTED_MODULE_0__.createClientAsync) is not a function
    at new AppComponent (app.component.ts:15:22)
    at NodeInjectorFactory.AppComponent_Factory [as factory] (app.component.ts:21:4)
    at getNodeInjectable (core.mjs:3574:1)
    at instantiateRootComponent (core.mjs:10193:1)
    at createRootComponent (core.mjs:12297:1)
    at ComponentFactory.create (core.mjs:21654:1)
    at ApplicationRef.bootstrap (core.mjs:26538:1)
    at core.mjs:26219:1
    at Array.forEach (<anonymous>)
    at PlatformRef._moduleDoBootstrap (core.mjs:26219:1)

I am importing the client code in the package.json like so:

"ogdrisservice": "file:generated/ogdrisservice"

and I am referencing the directory in tsconfig.json

    "lib": [
      "es2018",
      "dom"
    ],
    "paths": {
      "ogdrisservice": ["./generated/ogdrisservice"]
    }
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
  },
  "include": ["./generated/ogdrisservice"]
}

This is the code which is supposed to create the client:

import { Component } from '@angular/core';
import {createClientAsync} from "ogdrisservice";


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {

  constructor() {
    console.log(createClientAsync);
    createClientAsync("")
      .then(
        (client) => {
          console.log(client);
        }
      );
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant