Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b6f24f0

Browse files
committed
Adding SkillsDataService, because I need custom URL for entity collection, because ngrx incorrectly appends a slash at the end of the standard URL
1 parent ac6f76d commit b6f24f0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { DefaultDataService, DefaultDataServiceConfig, DefaultHttpUrlGenerator, DefaultPluralizer } from "@ngrx/data";
2+
import { HttpClient } from '@angular/common/http';
3+
import { StructSkill } from "./models/struct-skill";
4+
5+
export class SkillsDataService extends DefaultDataService<StructSkill> {
6+
private defaultDataServiceConfig: DefaultDataServiceConfig;
7+
constructor(http: HttpClient,
8+
defaultDataServiceConfig: DefaultDataServiceConfig) {
9+
const urlGenerator = new DefaultHttpUrlGenerator(new DefaultPluralizer([]));
10+
//const url = new DefaultHttpUrlGenerator();
11+
const urlRoot = defaultDataServiceConfig.root;
12+
const resourceUrls = {
13+
entityResourceUrl: `${defaultDataServiceConfig.root}/structskill`,
14+
collectionResourceUrl: `${defaultDataServiceConfig.root}/structskills`
15+
};
16+
urlGenerator.registerHttpResourceUrls({['StructSkill']: resourceUrls});
17+
super('StructSkill', http, urlGenerator);
18+
this.defaultDataServiceConfig = defaultDataServiceConfig;
19+
}
20+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /