Please forgive the length of this question, as I struggled to condense it.
My current challenge lies in understanding the interplay between a controller and its view within Ember.js. Specifically, I am grappling with the concept of controller property and view bindings. While my application is functional, I sense that the approach I have taken may not align with the preferred 'Ember.js' methodology.
Key details to note: My project follows the directory/file structure suggested in the guides/documentation. It operates within a sinatra application environment. Despite being a work in progress, the application behaves as expected thus far.
Although incomplete, here's a high-level overview of what I aim to achieve:
1) Upon visiting the root URL '/', users are directed to '/locate'.
2) The LocateController fetches the user's location and populates form fields with latitude/longitude data.
3) Upon submitting the form via AJAX POST to the sinatra '/locate' route...
(request processed by server)
4) Users are then redirected to the ember.js '#/located' route.
5) JSON response from the server is displayed.
I've only implemented step one thus far. While the form can be manually submitted, the goal is for an automatic submission.
The locate view correctly populates the form fields. However, achieving this using jQuery directly doesn't seem consistent with proper Ember.js practices.
Below are select code snippets:
Snippet of slim views:
... // Omitted for brevity
Snippet from applicationView.js:
... // Omitted for brevity
Snippet from applicationController.js:
... // Omitted for brevity
Snippet from router.js:
... // Omitted for brevity
While I have consulted the Ember.js Guides, API Documentation, and GitHub repository, I still struggle to grasp the implementation of computed properties for latitude and longitude attributes.
Additionally, I acknowledge that there might be a more efficient way to handle data transfer to the server (e.g., JSON or ember-data), but for now, I prefer solutions that won't require significant backend restructuring.
Your insights and guidance on these matters would be appreciated. Thank you for your time and consideration amidst this lengthy query.