Angularjs app unable to retrieve data after deployment

Currently, I am working on a local server developing an AngularJS app on localhost. I have shared the project link with my colleagues using my current IP address within the network to receive feedback. However, when they visit the page, no data is displayed, even though it appears correctly on my own computer.

Is there something I am overlooking in terms of procedures or configurations? Could someone provide me with guidance or links on how to resolve this issue?

Thank you in advance!

Answer №1

It seems like the issue may be occurring because your data is currently bound to localhost or 127.0.0.1, which would only work on your own machine. To make sure your colleagues can access the backend/data as well, consider binding it to your IP address instead. This simple adjustment should resolve the problem for everyone. Also, using a constant for your IP address will streamline the deployment process in the future.

angular.module('myApp')
    .constant('SERVER', '192.168.0.101/api/');

angular.module('myApp')
    .controller('myController', ['SERVER', '$resource', function(SERVER, $resource) {
        var vm = this;
        var data = $resource(SERVER + 'resource')

        vm.server = SERVER;
        vm.data = data.get();
    }]);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Rendering on the server with React, React-Router, and Express

I'm currently in the process of setting up server-side rendering for my react application and I'm utilizing the fantastic react-router module to enable it to manage non-js scenarios (such as certain crawlers or users with javascript disabled). Ne ...

Implementing React hooks to efficiently remove multiple items from an array and update the state

Looking for help on deleting multiple items from an array and updating the state. I have selected multiple items using checkboxes, which are [5, 4, 3]. My goal is to remove all these items from the array based on their ids and then update the state accordi ...

Tips for using the .innerHTML method to reference multiple indexes

How can I set the .innerHTML for multiple indexes of an array? I currently have an array let poles = Array.prototype.slice.call(document.querySelectorAll(".pole")); This array contains 9 empty divs, such as : <div class="pole" id="1"></div> ...

Make the div disappear upon clicking the back button in the browser

When a user selects a thumbnail, it triggers the opening of a div that expands to cover the entire screen. Simultaneously, both the title and URL of the document are modified. $('.view-overlay').show(); $('html,body').css("overflow","h ...

``Can anyone provide guidance on extracting data from Xmlhttprequest POST request on my Nodejs express backend?"

Is there a way to properly send the values of candid and candidresults to my backend route /savevote in Express? Any help on how to achieve this would be appreciated. var candid; var candidresults; ...

Using JQuery to manipulate `this`, its children, its siblings, and more

Can anyone help me determine the most effective way to send data from a get request to a specific div? My challenge is to send it only to a div that is related to the one triggering the action. For example, when I click on the message_tab, I want to send t ...

Incorporate the Vue JS response into the table component

I am attempting to append my response from Vue into a table but I am unable to do so and I don't know why. I can retrieve all the data from my database, I can see it in my web browser console, but my table remains empty. Below is my current code: Vu ...

Instructions for modifying the color of the close button in the angularjs ui-select module

I am currently using ui-select for multiple selection in a dropdown. When an item is selected, it displays a cross button on the upper right corner of the selected item. Is there a way to change the color of the cross button to red? <ui-select multip ...

Relaunch jQuery script on dynamically loaded content via AJAX requests

Currently, I am utilizing the Advanced Ajax Page Loader plugin for wordpress to dynamically load content through ajax. However, I am encountering an issue where my custom jquery scripts do not execute properly when the content is loaded via ajax. Interesti ...

The functionality of the controls is not functioning properly when attempting to play a video after clicking on an image in HTML5

While working with two HTML5 videos, I encountered an issue with the play/pause functionality. Despite writing Javascript code to control this, clicking on one video's poster sometimes results in the other video playing instead. This inconsistency is ...

AngularJS - Storing user-entered text and showcasing it on a separate webpage

I have a text input on one page that I want to save with AngularJS, so I can display it in another input on a different page. I've attempted using ng-model and ng-init <input type="text" ng-model="inputText" ng-init="userText"> In the controll ...

By pressing enter, Combobox autocomplete feature automatically selects the first item in the suggestion list

I have successfully implemented a jQuery combobox autocomplete feature, similar to the one on the demo below. jQuery combobox autocomplete Is there a way to configure the jQuery combobox autocomplete to automatically select the top suggestion when the ...

Determine whether a variable includes an alphabetic character

I need to eliminate any results from an array that include alphabetic characters. To do this, I am using the following code: if(gtin.toString().length != 13 || /[a-z\-]+/ig.test(gtin) == true) { gtin = "null"; } Although it works for some variab ...

Discover the best way to integrate your checkbox with your Jquery capabilities!

I am having trouble getting my 3 checkboxes to interact with the JQuery button I created. The goal is for the user to be able to select an option, and when the button is clicked, the selected options should download as a CSV file from my feeds. Below is th ...

Enhance headers with authLink in react-apollo post-authorization

Utilizing the Github Graphql API has been quite a journey for me. Upon the initial load of my application, I direct the user to fetch an access_token. The process works smoothly, however, since the app has already loaded, I face the challenge of updating ...

Difficulty displaying data from PapaParse in VueJS despite successful retrieval in console

My first attempt at using PapaParse is running into some issues. I am successfully parsing a remote CSV file and storing the data, as confirmed by console.log. However, when I try to output it with a v-for loop, nothing seems to be working. To achieve thi ...

AngularJS ng-model not refreshing its data

I am currently facing an issue with my HTML code. The problem is that the model (filter) changes when I select one of the static options, but it does not trigger a change for the dynamic options. Any suggestions on how to fix this? Thank you. <div cla ...

Harness the power of Bootstrap 5.3 color modes based on the user's browser

It has come to my attention that Bootstrap 5.3 introduces support for a customizable color scheme, allowing me to personalize various key features. Interestingly, the default dark theme now relies on the explicitly defined bs-theme data attribute rather t ...

Ajax- priorToSend

To avoid encountering the same error twice, I implemented the use of beforeSend in my code. hasSent = false function submit() { if (!hasSent) { $.ajax({ url: "${createLink(controller:'userInvitation', action:'ajaxUp ...

What is the best way to create a map in React that allows for changing the state without affecting all elements?

When working with a JSON file containing various values, one of them being "iframe" which can hold either "si" (yes) or "no" based on whether it should include an iframe. With this value (yes/no), I need (this.props.tabsiframe === 'yes') to deter ...