question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not able to handle nested folder structure for namespaces

See original GitHub issue

Support Request


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[x] Support request
[ ] Other... Please describe:

Current behavior

Lazy loading module

AccountModule.ts

@NgModule({
  declarations: [AccountCComponent,AccountPComponent],
  imports: [
    CommonModule,
    AccountRoutingModule,
    MaterialModule,
    FormsModule,
    ReactiveFormsModule,
    FormElementsModule,
    DirectivesModule,
    TranslocoModule
  ],
  providers: [{ provide: TRANSLOCO_SCOPE, useValue: { scope: 'master-services/temp-account', alias: 'account' } }],
  entryComponents: [AccountPComponent]
})

transloco.loader.ts

import { HttpClient } from '@angular/common/http';
import { Translation, TRANSLOCO_LOADER, TranslocoLoader } from '@ngneat/transloco';
import { Injectable } from '@angular/core';


@Injectable({ providedIn: 'root' })
export class HttpLoader implements TranslocoLoader {
  constructor(private http: HttpClient) {}

  getTranslation(langPath: string) {
    console.log(langPath);
    return this.http.get<Translation>(`/assets/i18n/${langPath}.json`);
  }
}

export const translocoLoader = { provide: TRANSLOCO_LOADER, useClass: HttpLoader };


output of console.log(langPath) is “[object Object]/ar”

Expected behavior

output of console.log(langPath) is “master-services/temp-account/ar”

What is the motivation / use case for changing the behavior?

Need to use nested folder structure

Environment


Angular version: 7


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [X] Firefox version 70.0b11
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
devKombancommented, Oct 8, 2019

It worked Thanks a lot itayod

0reactions
itayodcommented, Oct 8, 2019

Could you try update to the newest? Until version 2.1.0 we didn’t accept object as scope value

Read more comments on GitHub >

github_iconTop Results From Across the Web

Namespaces and folder structures in c# solutions: how should ...
I use the flat approach. I find a nested hierarchy too hard to maintain. I group my projects into several solutions, with maximum ......
Read more >
Matching namespaces to folders is an anti-pattern - Medium
In many languages and development environments, it is common to use the same names for folders that you do for namespaces.
Read more >
maintain nested structure when replicating artifacts #12890
If I have a project with a nested folder structure (e.g. my-project/foo/bar ) and I replicate the contents of that project, I would...
Read more >
Cannot create nested network namespace - Server Fault
1 Answer 1 · process: that's the main method, and most of the time that's how the namespace is used at all ·...
Read more >
Namespaces and File Structure - LearnHowToProgram.com
Let's refactor our code and address the proper file structure for a C# application. ... but specifically does not import nested namespaces.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found