Coder Social home page Coder Social logo

Comments (5)

Gorniv avatar Gorniv commented on May 18, 2024

Do you use absolute URL for the request?
You need to reproduce the problem with the public repository.

from universal-starter.

shahbazkhan054 avatar shahbazkhan054 commented on May 18, 2024

Hi Gorvin,

Thank you for your reply and suggestion. But it doesn't work even after ensuring absolute path.

Please find code snippets :

component :

self.apiService.get('getPapersOfBoard', 'boardName=' + self.boards.toUpperCase()).subscribe(res => {
        self.apiService.list('getSubjectDescription').subscribe(result => {
          result['sujectDescription'].forEach(element => {
            res.boardName['class'].forEach(cl => {
              cl['subject'].forEach(sub => {
                if (sub.name === element.subject_id.name && cl.name === element.class_id.name
                  && self.boards.toUpperCase() === element.board_id.name) {
                  sub.description = element.description;
                  sub.title = element.title;
                }
              });
            });
          });
          self.apiService.setData(res.boardName);
          self.getTree(params);
          self.spinner.hide();
        });
      });

Apiservice.ts

constructor(private httptransfer: TransferHttpService, @Inject('ORIGIN_URL') public baseUrl: string,) { }
.....

 get(modelName: string, id: string): Observable<any> {
    return this.httptransfer.get(environment.apiEndpoint.concat(modelName).concat('?').concat(id));
  }

  list(modelName: string, criteria = {}, limit = '1000', skip = '0', sort = 'updatedAt DESC'): Observable<any> {
    const listOptions = new HttpHeaders();
    return this.httptransfer.get(environment.apiEndpoint.concat(modelName));
  }

environment.ts

export const environment = {
  production: false,
  apiEndpoint: 'http://0.0.0.0:3000/api/',
  isServer: true,
  // for prerender
  host: 'http://localhost:4200/',
};

Can you please help me out with this?

from universal-starter.

shahbazkhan054 avatar shahbazkhan054 commented on May 18, 2024

Dependency injection issue solved.

from universal-starter.

Gorniv avatar Gorniv commented on May 18, 2024

@shahbazkhan054 can you write more information about the solution?

from universal-starter.

shahbazkhan054 avatar shahbazkhan054 commented on May 18, 2024

Changes I made to fix the issue :

  1. The TransferHttpModule and transferHttpService should be used in one module.
    I removed TransferHttpModule from shared module to AppModule and also add provider as transferHttpService and apiService.
  2. Typescript version : 3.1.1 -> 3.1.6

from universal-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.