GithubHelp home page GithubHelp logo

angular4-hal's People

Contributors

bobbyhirstrocc avatar cjansen18 avatar felixfiskare avatar fuitattila avatar hrcerqueira avatar kranich avatar rainmore avatar rogargon avatar ronkillerman avatar sante85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular4-hal's Issues

Error: StaticInjectorError(AppModule)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]: StaticInjectorError(Platform: core)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]: NullInjectorError: No provider for InjectionToken DocumentToken! Error: StaticInjectorError(AppModule)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]: StaticInjectorError(Platform: core)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]: NullInjectorError: No provider for InjectionToken DocumentToken!

I created new project from downloaded http from:
https://angular.io/guide/http#intercepting-all-requests-or-responses (downloaded example)

And I added Angular4-hal from you tutorial and I have an error if I try getting data from my server:

Error: StaticInjectorError(AppModule)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]:
StaticInjectorError(Platform: core)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]:
NullInjectorError: No provider for InjectionToken DocumentToken!
Error: StaticInjectorError(AppModule)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]:
StaticInjectorError(Platform: core)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]:
NullInjectorError: No provider for InjectionToken DocumentToken!

I uploaded my project here: https://github.com/karqu/angular4-hal-example-project

serialize / desirialize (ExternalConfigurationHandlerInterface)

I've found no documentation about the implementation of serialize/deserialize method of the interface ExternalConfigurationHandlerInterface.
If I follow the tutorial i can't get work the module due to wrong implementation of the interface.
Anyone experiencing the same problem?
Solutions?
Thanks in advance

Angular Hal Example

Hi, Can anyone please provide a working example. Iam trying to retrieve data for a given id and I am using get method but it wont concatenate id to the api url.. Not sure what Iam doing wrong. An example would help me to better understand this module.

Thanks a lot

No provider for InjectionToken DocumentToken!

When trying to use the library, it gives me the following message right when I hit a page that uses a HAL-enabled service:

ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]: 
  StaticInjectorError(Platform: core)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]: 
    NullInjectorError: No provider for InjectionToken DocumentToken!
Error: StaticInjectorError(AppModule)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]: 
  StaticInjectorError(Platform: core)[HttpXsrfTokenExtractor -> InjectionToken DocumentToken]: 
    NullInjectorError: No provider for InjectionToken DocumentToken!
    at _NullInjector.get (core.js:994)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveNgModuleDep (core.js:10836)
    at _createClass (core.js:10877)
    at _createProviderInstance$1 (core.js:10847)
    at _NullInjector.get (core.js:994)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveNgModuleDep (core.js:10836)
    at _createClass (core.js:10877)
    at _createProviderInstance$1 (core.js:10847)
    at resolvePromise (zone.js:809)
    at resolvePromise (zone.js:775)
    at eval (zone.js:858)
    at ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:4724)
    at ZoneDelegate.invokeTask (zone.js:420)
    at Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)
    at ZoneTask.invokeTask [as invoke] (zone.js:500)
    at invokeTask (zone.js:1517)

Error on building ng -serve version 4.3.3

Greetings!.

Setting the latest version 4.3.3 I found the following build error.

Version 4.3.3
``
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-03-31T15:47:43.728Z
Hash: ca093c63a080102267d0
Time: 8658ms
chunk {inline} inline.bundle.js (inline) 3.85 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 211 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 557 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 634 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 13.4 MB [initial] [rendered]

ERROR in ./node_modules/angular4-hal/index.ts
Module build failed: Error: /home/blackswan/git/transit-client/transti-hub-client/node_modules/angular4-hal/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
at AngularCompilerPlugin.getCompiledFile (/home/blackswan/git/transit-client/transti-hub-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:674:23)
at plugin.done.then (/home/blackswan/git/transit-client/transti-hub-client/node_modules/@ngtools/webpack/src/loader.js:467:39)
at
at process._tickCallback (internal/process/next_tick.js:188:7)

webpack: Failed to compile.

Need help with _embedded resources

Hello,
I need help on how to handle embedded resources, if we take the readme example with teams and players, then what i get from my api is something like this:

{ _links:{ self: { href: {'/teams/1'} } }, _embedded: { players: [ list of resources ] } }

from what i saw, getRelationArray is looking through links but could you give me some insights on how embedded resources are handled ?

Thanks in advance,

Errors when building

I get these errors when doing a build:
node_modules/angular4-hal/src/array-interface.ts(21,5): error TS7010: 'push', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/angular4-hal/src/resource-helper.ts(59,15): error TS2322: Type 'ResourceArray' is not assignable to type 'ResourceArray'.
Type 'Resource' is not assignable to type 'T'.
node_modules/angular4-hal/src/resource.service.ts(70,29): error TS2304: Cannot find name 'Response'

I'm using Angular: 4.3.6

Errors when using `getRelation` or `getRelationArray` when `_link` key does not exist

getRelation and getRelationArray both check that _links is defined, but do not check that the relational key is also defined. This is a problem if you're using subtypes for your classes that may/may not have the relational links.

Eg. I have a bunch of subtypes for a Server. Some of these subtypes have a relationship to a Cluster, some have a relationship to Region, but never both.

Response and Request Headers

Hey guys! Awesome library!

We've got the problem that we cannot retrieve the response headers form any performed request. In this case we'd like to retrieve an "ETag" from a given resource. Is there a way to set the {observer: 'response'} option somehow?

Thanks!

angular4-hal example

Hi - Do you have an example of angular4-hal within a working application? This library seems to do exactly what we need, but I am having some issues that I think looking at a working example would resolve. Thanks

Any plans to provide a way to handle serialization/deserialization of objects?

Loving the library, but would love it even more if there was a way to provide a custom way to handle serialization/deserialization of entities. I'm currently using json-object-mapper in other projects of mine to convert objects (such as dates returned downstream as an ISO string into a JS Date, and back to ISO string when posting upstream). ResourceService currently has a hard dependency on ResourceHelper's static methods and makes it difficult to provide any custom serialize/deserialize capabilities.

Post and Put operations do not match specification

This library does not appear to match the hal spec in regards to doing post and put operations.

The examples shown from Spring indicate that the server returns a Resource, but the client is expected to post back the embedded object, and not the Resource. When using this framework and calling a method on a service such as update, it sends back the Resource to the post method, which does not appear to match the specification that Spring is promoting.

example:
GET returns PlayerResource to client
POST client is to return an instance of Player, not PlayerResource

public ResponseEntity < PersonResource > post(@RequestBody final Person personFromRequest) { final Person person = new Person(personFromRequest); personRepository.save(person); final URI uri = MvcUriComponentsBuilder.fromController(getClass()).path("/{id}").buildAndExpand(person.getId()).toUri(); return ResponseEntity.created(uri).body(new PersonResource(person)); }

https://dzone.com/articles/applying-hateoas-to-a-rest-api-with-spring-boot

Extending of Resource class drops production build error

Dear @sante85 i have a problem, with my build, please help me.

Ng version: ^7.2.4
angular4-hal version: ^7.8.1,

First of all i have a question: why is Resource class an injectable?

My production build error is:

Warning: Can't resolve all parameters for EventModel in : (?). This will become an error in Angular v6.x

I think because of @Injectable() decorator fails the production build.

Example code to produce the error:

import {Resource} from 'angular4-hal';

export class EntityModel<T> extends Resource {
    readonly id?: number;

    constructor(init?: Partial<T>) {
        super();
        Object.assign(this, init);
    }
}

What should i do to fix this?

How to do Unit tests?

I'm trying to use Unittests (Karma with Jasmine) for my project. Unfortunately all my services throw this error

Error: StaticInjectorError(DynamicTestModule)[ResourceService]: 
  StaticInjectorError(Platform: core)[ResourceService]: 
    NullInjectorError: No provider for ResourceService!

Additionally I need to create my own Resource Base class for all my models to inherit from. Is there an easier way which I'm overlooking?

Lack of documentation

This package is probably the only actively mantained, recently updated one to consume Spring Data Rest HAL output in Angular, which is something to be thankful for, specially since the seems to be only one active contributor.

However, I am missing some proper, even if simple, documentation; because the tutorial is kind of outdated, and there are much more options and functions than the ones shown in the tutorial, using this package becomes kind of painful and confusing.

Uncaught Error: Can't resolve all parameters for ResourceService: (?).

I've just build a minimal example which is very close to that one from the tutorial. Unfortunately, I'm encountering the following error when loading the page:

compiler.js:485 Uncaught Error: Can't resolve all parameters for ResourceService: (?). at syntaxError (compiler.js:485) at CompileMetadataResolver._getDependenciesMetadata (compiler.js:15700) at CompileMetadataResolver._getTypeMetadata (compiler.js:15535) at CompileMetadataResolver._getInjectableMetadata (compiler.js:15515) at CompileMetadataResolver.getProviderMetadata (compiler.js:15875) at eval (compiler.js:15786) at Array.forEach (<anonymous>) at CompileMetadataResolver._getProvidersMetadata (compiler.js:15746) at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15314) at CompileMetadataResolver.getNgModuleSummary (compiler.js:15133)

I would be glad to provide any further information that help fixing this issue, since I would really like to use angular4-hal.

Error with ng build --prod

Hi again, after solving #9 I'm trying to execute again "ng build --prod" and gives me this error:

ERROR in ./node_modules/angular4-hal/index.ts
Module build failed: Error: \node_modules\angular4-hal\index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
at AngularCompilerPlugin.getCompiledFile (\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (\node_modules@ngtools\webpack\src\loader.js:467:39)
at process._tickCallback (internal/process/next_tick.js:109:7)

ERROR in ./node_modules/angular4-hal/src/external.service.ts
Module build failed: Error:\node_modules\angular4-hal\src\external.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
at AngularCompilerPlugin.getCompiledFile (\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (\node_modules@ngtools\webpack\src\loader.js:467:39)
at process._tickCallback (internal/process/next_tick.js:109:7)

ERROR in ./node_modules/angular4-hal/src/resource.service.ts
Module build failed: Error: \node_modules\angular4-hal\src\resource.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
at AngularCompilerPlugin.getCompiledFile \node_modules@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then \node_modules@ngtools\webpack\src\loader.js:467:39)
at process._tickCallback (internal/process/next_tick.js:109:7)

I checked the src folder and there isn't any of the files that give me the error and after some digging I found this #github.com/ng-cli#8284 and I think that I'm on the right track but not able to resolve it.

This is due a bad packaging? Because if I clone the project and try to compile by myself every .js is there normally... Thank you for your effort

Automatically fetch relations

Is there a way to automatically fetch the relations?
When I fetch entity that contains a related entity, the related entity it's not fetched by default.
I've to call getRelation()/getRelationArray() on the owner entity.
Thank you in advance

Use ProvideTokens instead of string

As part of the configuration we must add a provider which is being added with a string ExternalConfigurationService as part of good practices is preferred to use Tokens instead, please refer to this link to see what is expected

RestService uses rxjs/internal/Observable

The RestService uses rxjs/internal/Observable instead of rxjs/Observable. This is not really a bug, but quite cumbersome because it is not possible to return the Observable in your service. You always have to make a additonal transformation. Additionally it is inconsistently, because the ResourceService uses the normal rxjs/Observable.

Licensing change

I notice the license has been switched to GPL. This means I won't be able to use recent versions, as there are commercially licensed components mixed in my with code which I am not able to release under a GPL licence, should I upgrade to the most recent few versions of the library.

Please re-consider the change from MIT to GPL, as I'm sure I'm not the only one in this position. But if you are committed to going down this path, then don't forget to change your licence type in package.json, as it's still showing on npmjs as MIT licensed.

For anyone wondering, 7.5.3 was the last version released before the licensing changed from MIT to GPL, so if you are in my position, this is the last version you can safely use if you do not wish to be subject to GPL restrictions.

TS2416 error after upgrade to 7.7.0

I just updated to version 7.70 and the following error occured during building:

ERROR in node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11):
 error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.
Time: 6292ms
node_modules/angular4-hal/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): 
error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.
chunk {main} main.js, main.js.map (main) 636 bytes [initial] [rendered]
src/app/services/externalconfiguration.service.ts(16,3): error TS2416: 
Property 'getHttp' in type 'ExternalConfigurationService' is not assignable 
to the same property in base type 'ExternalConfigurationHandlerInterface'.
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 92.4 kB [initial] [rendered]
  Type '() => import("node_modules/@angular/common/http/src/client").HttpClient' 
is not assignable to type '() => import("node_modules/angular4-hal/node_modules/@angular/common/http/src/client").HttpClient'.
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
    Type 'import("node_modules/@angular/common/http/src/client").HttpClient' is not assignable to type 'import("node_modules/angular4-hal/node_modules/@angular/common/http/src/client").HttpClient'.
chunk {styles} styles.js, styles.js.map (styles) 900 kB [initial] [rendered]      
Types have separate declarations of a private property 'handler'.

I am using Angular 7.2.2. Could this be a compatibility issue between the Angular version 7.1.4? Downgrading to 7.6.5 solves it for me.

Thanks for the help and the great work maintaining this project

Npm 3.2.0 and github 3.2.0 missmatch

Hi, I updated to 3.2.0 and when i do the npm install everything stopped work. I see that the folder src isn't there anymore and the dist/ folder neither.

Delete /dist it's ok to me because npm generates everytime but i think that you added src to .npmignore wrongly and it's not been delivered anymore via npm.

I did some tests with my forked project and added src manually but when i try to do a ng build --prod in my project it fails with:

ERROR in Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'AngularHalModule' was called.

Do you know what's happening?

API for totalPages

Please provide totalPages API to access the total pages from the paged response.

It would be nice to provide an API to return the Page object.

Error using addRelation

The error that gives me it's this:

ERROR TypeError: Cannot read property 'append' of undefined
at MyObjectHal.Resource.addRelation (resource.ts:64)

I don't see where is the headers field being initialized and this is where is giving me the null

Errors when compiling in Angular 6.

I'm getting some errors when compiling the project using Angular 6.0.5 and RxJS 6.2.1. I am using rxjs-compat as I get even more errors if I try to compile it without the compatibility shim. I don't know if I am missing something but I would appreciate some help! Thanks!
Here is the error:

node_modules/angular4-hal/dist/src/rest.service.d.ts(28,40): error TS2314: Generic type 'ErrorObservable<T>' requires 1 type argument(s).
node_modules/angular4-hal/dist/src/rest.service.d.ts(29,47): error TS2314: Generic type 'ErrorObservable<T>' requires 1 type argument(s).
node_modules/angular4-hal/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.

PS: After some quick searching, it may be caused by the fact that you have 2 node_modules in the library.

Substitute relation and add relation are both using PUT

The resource.ts object uses PUT method for addRelation instead of POST.

PUT will replace all the existing associated resources, while POST will attempt to append.

PUT
Binds the resource pointed to by the given URI(s) to the resource.

// Bind the given resource to this resource by the given relation
public substituteRelation<T extends Resource>(relation: string, resource: T): Observable<any> {
    if (this.existRelationLink(relation)) {
        let header = ResourceHelper.headers.append('Content-Type', 'text/uri-list');
        return ResourceHelper.getHttp().put(ResourceHelper.getProxy(this.getRelationLinkHref(relation)), resource._links.self.href, {headers: header});
    } else {
        return observableThrowError('no relation found');
    }
}

POST
Only supported for collection associations. Adds a new element to the collection.

// Adds the given resource to the bound collection by the relation
public addRelation<T extends Resource>(relation: string, resource: T): Observable<any> {
    if (this.existRelationLink(relation)) {
        let header = ResourceHelper.headers.append('Content-Type', 'text/uri-list');
        return ResourceHelper.getHttp().put(ResourceHelper.getProxy(this.getRelationLinkHref(relation)), resource._links.self.href, {headers: header});
    } else {
        return observableThrowError('no relation found');
    }
}

AddRelation should use:
return ResourceHelper.getHttp().post(...);

See Spring Data Rest Docs

Error using search: 'Observable<Observable<never> | Country>' is not assignable to type 'Observable<Country>'.

Hello,

The Library is perfectly working to fetch everything and creating an element in the DB. I have an issue using "search" method. Here are some codes samples and additional informations.

Here is the method:
public findByCode(code: string): Observable<Country[]> { const options: any = {params: [{key: 'code', value: code}]}; return this.search('findByCode', options); }

and the error code:

ERROR in src/app/country.service.ts(14,5): error TS2322: Type 'Observable<Observable | Country>' is not assignable to type 'Observable'.
Type 'Observable | Country' is not assignable to type 'Country'.
Type 'Observable' is not assignable to type 'Country'.
Property '_code' is missing in type 'Observable'.

Any idea? Not sure it's related to the plugin tho.

Thanks guy!

Unable to compile project

When trying to use the library as written, I've got this error on the console (directory structure omitted):

ERROR in ./node_modules/angular4-hal/index.ts
Module build failed: Error: /***/node_modules/angular4-hal/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).

The build script is: ng build --prod --aot=false --output-path ui-dist/META-INF/resources

My package.json looks like this (the relevant part):

"dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/cdk": "^5.0.4",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/material": "^5.0.4",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "angular4-hal": "1.7.4",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "primeng": "^5.0.2",
    "rxjs": "^5.5.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.6.3",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"
  }

No provider for InjectionToken proxy.uri!

When I don't set PROXY_URI, it gives me the following message:

ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[ExternalService -> InjectionToken proxy.uri]: 
  StaticInjectorError(Platform: core)[ExternalService -> InjectionToken proxy.uri]: 
    NullInjectorError: No provider for InjectionToken proxy.uri!
Error: StaticInjectorError(AppModule)[ExternalService -> InjectionToken proxy.uri]: 
  StaticInjectorError(Platform: core)[ExternalService -> InjectionToken proxy.uri]: 
    NullInjectorError: No provider for InjectionToken proxy.uri!
    at _NullInjector.get (core.js:994)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveNgModuleDep (core.js:10836)
    at _createClass (core.js:10877)
    at _createProviderInstance$1 (core.js:10847)
    at _NullInjector.get (core.js:994)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveToken (core.js:1292)
    at tryResolveToken (core.js:1234)
    at StaticInjector.get (core.js:1102)
    at resolveNgModuleDep (core.js:10836)
    at _createClass (core.js:10877)
    at _createProviderInstance$1 (core.js:10847)
    at resolvePromise (zone.js:809)
    at resolvePromise (zone.js:775)
    at eval (zone.js:858)
    at ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:4724)
    at ZoneDelegate.invokeTask (zone.js:420)
    at Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)
    at ZoneTask.invokeTask [as invoke] (zone.js:500)
    at invokeTask (zone.js:1517)
defaultErrorLogger @ core.js:1440
ErrorHandler.handleError @ core.js:1501
next @ core.js:5481
schedulerFn @ core.js:4319
SafeSubscriber.__tryOrUnsub @ Subscriber.js:240
SafeSubscriber.next @ Subscriber.js:187
Subscriber._next @ Subscriber.js:128
Subscriber.next @ Subscriber.js:92
Subject.next @ Subject.js:56
EventEmitter.emit @ core.js:4299
(anonymous) @ core.js:4755
ZoneDelegate.invoke @ zone.js:388
Zone.run @ zone.js:138
NgZone.runOutsideAngular @ core.js:4681
onHandleError @ core.js:4755
ZoneDelegate.handleError @ zone.js:392
Zone.runGuarded @ zone.js:154
_loop_1 @ zone.js:684
api.microtaskDrainDone @ zone.js:693
drainMicroTaskQueue @ zone.js:602
ZoneTask.invokeTask @ zone.js:500
invokeTask @ zone.js:1517
globalZoneAwareCallback @ zone.js:1543

Maybe somehow related to #3 , I suppose it's not mandatory to give PROXY_URL

Subsequent navigational methods returns empty array

Hello! :)

First, thanks for developing this. It's proving to be very useful to me. Now, the issue: I read the README and other issues and even the source code, but I can't seem to understand why navigational methods (e.g. next, last, first) aren't working even after calling getAll or search.

Here is the code:

this.proxyService.getAll({ size: 10, sort: [{ path: 'nome', order: 'ASC' }] })
      .subscribe(p1 => {
        console.info(p1);
        this.proxyService.next().subscribe(p2 => console.info(p2));
      });

Please, note that:

  • The first request occurs;
  • p1 returns an array, as expected;
  • The second requests occurs as well;
  • But p2 is empty.
  • There are 56 items in my collection (page size 10, as it can be seen above)

I've checked the responses (p1 and p2) from the backend service and they are correct. The problem seems to be happening while deserializing (in this case, p2).

Could you be of any assistance? Thanks!

No provision to access few data properties outside "_embedded" from base URI response

Hello,

I have a response to base URI call as below.
{
"firstName": "abcd",
"lastName": "xyz",
"_embedded": {
"myaccounts": [{
"accountDesc": "Personal Account",
"accountNo": "123456"
}]
}
}

When i get the result from calling the getAll Method of the HAL client API i get only the contents inside the "_embedded" property as a list of objects. There is no way i can get the properties "firstName" and the "lastName". If it exists how can be accessed or if not can it be added? Please look into this issue. I appreciate if anybody responds to this as i am stuck on this since many days. Thank you.

error with ng build --prod

hi,

i've got this error when build prod with version 4.3.6.

ERROR in Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'AngularHalModule' was called.

Anyway it works fine....
Thanks

Accessing multiple HATEOAS/HAL/SDREST APIs

Not sure if this is how to contact about questions or feature requests so I apologize in advance if this not the correct place.

i've been looking for an angular library for interacting with Spring Data REST HAL APIs. Yours seems the most complete and most downloaded. However, skimming the documentation, I'm seeing some things that may prevent me from using this library, but maybe these are more my lack of understaing with the library and or angular (fairly new to angular).

The first thing i noticed was that it seems to only work with a single SD REST resource. For my need, i've created a set of microservices of which a bunch of them are SD REST resources that live at different base URL's (either their own or more likely being a ZUUL proxy). Is there any way connect to multiple with this library?

I have others but wondering if you prefer them as different issues.

Thank you for putting this project together and for your response.

/node_modules should not be included in the npm package

Getting conflicts when using angular4-hal 6.3.1 because the package includes the node_modules folder, which includes rxjs 6.2.2.

This version of rxjs conflicts then with any other version above that, for instance 6.3.3 if using Angular 6.1.5+

Solved by going to ./node_modules/angular4-hal/ and removing manually the node_modules/ folder inside

Page Method on Service not working

Hi there,

I want to create a table with pagination from my Rest Resources.
Therefore I want use the page() function of my service, to avoid the use of getAll() function.

My service:
export class ImageService extends RestService<Image>{...}

My component:

export class ImagesComponent implements onInit {
...
constructor(private service: ImageService){...}

OnInit(){
this.service.page(0).subscribe(images => {...}
}

But nothing happens, when I call this.service.page(0) , no http request or anything else.

What am I missing?

Thank you all!

How do i connect to multiple apis?

Hi, I have multiple microservices to connect to for different components. Is there a way to connect to multiples apis? Thanks in advance for the response

One to One / One to many / Many to one / Many to many

Hi all,
Is there a documentation on how to persist relationship with angular4-hal?
I'm unable to getting persisted a basic One to One relation.
The Backend it's developed in Spring Boot rest and if i call it directly with a rest client I can persist the relationship.
This is my first approach to Angular so maybe I'm missing something trivial.

Any help would be appreciated

Igrone Spring template variables in url from links

In Spring Data Rest when we create a projection for some entity, Spring will generate for this entity in a link section additional template, for example:

{
   ....
   object_properties
   ....
    "_links": {
        "self": {
            "href": "http://localhost:8080/api/v1/users/1"
        },
        "user": {
            "href": "http://localhost:8080/api/v1/users/1"
        },
        "tasks": {
            "href": "http://localhost:8080/api/v1/users/1/tasks{?projection}",
            "templated": true
        }
}

And when in Angular we use getRelationArray(...) to get all tasks for the user, angular4-hal will send HTTP GET request to http://localhost:8080/api/v1/users/1/tasks{?projection} URL and we will get server error because this URL is not valid.

I think that we need to replace Spring template variables to an empty string when sending any HTTP requests through angular4-hal library.

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.