Comments (5)
Do you use absolute URL for the request?
You need to reproduce the problem with the public repository.
from universal-starter.
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.
Dependency injection issue solved.
from universal-starter.
@shahbazkhan054 can you write more information about the solution?
from universal-starter.
Changes I made to fix the issue :
- 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. - Typescript version : 3.1.1 -> 3.1.6
from universal-starter.
Related Issues (20)
- Nodemon error HOT 1
- 'format:check command not working HOT 1
- Question. InlineStyleComponent HOT 3
- Prerender- state undefined Is this error message?
- Remove dependency from package.json
- Host application on Azure HOT 1
- Validation do not work
- window is not defined with DOMINO - Angular 9 HOT 1
- Home page is not rendering as ssr: Angular 9
- Error: Can't set headers after they are sent. at SendStream.headersAlreadySent
- *Question* Setting Dynamic Meta Tags with HTTP calls? HOT 1
- how to add absolute path for scss files
- Error: Can't set headers after they are sent to the client
- How can i deploy on firebase HOT 5
- Postscribe(use to add 3rd party script) is not working: Angular 9 Universal.
- Looks like unused variable. HOT 1
- Translate Service NullInjection problem while prerendering HOT 2
- Cannot read property 'start' of undefined at new EffectsRootModule HOT 1
- Is there a way to implement proxy when do SSR?
- Is there any update for angular 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from universal-starter.