swagger-api / swagger-api/swagger-codegen

Angular 1 gen - Add basePath to inject and allow empty basepath

Open
#2,788 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: TypeScript Enhancement: General help wanted
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Add basePath to the inject array. In order to be able to use angular DI with a different basepath.

If base path is not present in inject array angular DI cannot resolve basePath when uglified.

Check for if(basePath !== undefined) instead of if(basepath) to allow an empty basePath

An empty basepath is handy when the API resides on the same host as the application

static $inject: string[] = ['$http', '$httpParamSerializer','basePath'];

constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) { if (basePath !== undefined) { this.basePath = basePath; } }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Angular 1 generator template and locate the generated service constructor and its $inject array. Compare the generated output with the snippets in the issue, then verify dependency injection after uglification and confirm that an empty basePath is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
angularjs, typescript
Domain
frontend, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.