Closed Shigawire closed 9 years ago
What's your route to that action?
Like this
servers_new GET /servers/new(.:format) servers#new
create_servers GET /servers/create(.:format) servers#create
update_server GET /servers/:id/update(.:format) servers#update
destroy_server GET /servers/:id/destroy(.:format) servers#destroy
start_server GET /servers/:id/start(.:format) servers#start
stop_server GET /servers/:id/stop(.:format) servers#stop
servers GET /servers(.:format) servers#index
server GET /servers/:id(.:format) servers#show
Edit: I've digged through the Javascript Code a bit, but could not find anything about anything other than CRUD.. The minified script made it a bit hard to inspect the code.
I don't think there's currently a method baked into the Angular package. You can always instantiate your own socket though:
var socket = new WebSocket('ws://localhost:3000/servers/1/start');
socket.onopen = function (data) { console.log('opened:', data); }
socket.onmessage = function (data) { console.log('message:', data); }
Or something similar. Entangled should take care of the rest in the backend though. If it doesn't, let me know.
Well, I thought so. Thanks for clearing that up!
In your backend code you provided the possibility to call custom actions additionally to the RESTful ones.
Let's assume I have the following code in my controller:
How would I call the start action from this client side?
Good work by the way! I really enjoy not having to take care of the data being pulled into the frontend.