Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using the directive if the context path is not root #31

Open
maeisabelle opened this issue Nov 10, 2017 · 5 comments
Open

Error when using the directive if the context path is not root #31

maeisabelle opened this issue Nov 10, 2017 · 5 comments

Comments

@maeisabelle
Copy link

maeisabelle commented Nov 10, 2017

I used the ml-visjs-graph directive in my application and it's working well when my app is in the root context path but when I tried to deploy my app in a path like http://localhost:8080/{contextpath}/, the call is pointing to http://localhost:8080/v1/resource instead of http://localhost:8080/{contextpath}/v1/resource. I think we need to set the VisjsGraphService api to v1/resource instead of /v1/resource. In the current version, is there a way to do that? I can see that the service has setApi but I think it's not exposed in the directive.

@grtjn
Copy link

grtjn commented Nov 10, 2017

I think you can do as follows:

  • In your application controller, inject visjsGraphService.
  • Use setApi('v1/resources') on that
  • Export the service to the scope or as a property of the ctrl
  • add graph-search="ctrl.service.graphSearch" and graph-expand="ctrl.service.graphExpand" to the directive tag in your view html

That ought to do the trick..

@maeisabelle
Copy link
Author

Hi @grtjn ,

setApi is not exposed because of the this.$get just limited the functions to search and expand. I'll try changing both functions instead. Thanks for the tip! :)

@grtjn
Copy link

grtjn commented Nov 10, 2017

Right, but it IS exposed. You can access it via the Provider that is automatically created for the service. You should be able to add this in your app.js (or similar):

  angular.config(['visjsGraphServiceProvider', function(visjsGraphServiceProvider) {
    visjsGraphServiceProvider.setApi('v1/resources');
  }]);

@grtjn
Copy link

grtjn commented Nov 10, 2017

@maeisabelle Above was tested locally both by me and @patrickmcelwee. That should work.

I'd like to keep the ticket open though. Patrick and I both think it would be useful to expose that setApi on the service object itself too..

@maeisabelle
Copy link
Author

Thanks @grtjn and @patrickmcelwee :) Very useful! Thanks for the prompt response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants