Angular JS shows different results in Google Chrome and FireFox, with some results not displaying in Chrome but showing up in Fire

I have developed a factory named SelectedProduct which is responsible for storing data from ProductDetailCtrl and fetching it in ProductOrder Ctrl

Below is the implementation of the factory:

    .factory('SelectedProduct',function(){
var products = {};

return{
    addCategory: function(_category){
        return products.category = {category: _category};
    },
    addSelectedProduct: function(_name, _image, _quantity, _price){
        return products.item = {name: _name, image: _image, quantity: _quantity, price: _price};
    },
    getSelectedProduct: function(){
        return products.item;
    },
    getCategory:function(){
        return products.category
    }
}
})

In my product_detail.html file, I save the parameters using ng-click as follows:

<img ng-src="{{product.image}}" alt="{{product.product_name}}"  ng-click="SelectImage((detail.image = product.image),(detail.name = product.product_name),(detail.quantity = product.quantity),(detail.price = product.price))" width="500" height="340">

In ProductDetailCtrl:

SelectedProduct.addCategory($stateParams.categoryName);
$scope.SelectImage = function () {
    SelectedProduct.addSelectedProduct($scope.detail.name,$scope.detail.image,$scope.detail.quantity,$scope.detail.price);
};

Subsequently, I display the saved data in product_order.html:

<h3>RM {{selectedProduct.price}}</h3>

My ProductOrderCtrl:

$scope.selectedProduct = SelectedProduct.getSelectedProduct();
var categoryName = SelectedProduct.getCategory();

However, there seems to be an issue with displaying the output on Chrome browser. The functionality works fine on other devices and browsers. I am puzzled as to why this discrepancy exists. Any insights or suggestions regarding this problem?

Note: The name and image link work correctly in Chrome, but the price shown in '00.00' format cannot be displayed. The price is fetched from an online MySQL database and stored as varchar.

Result in Chrome

https://i.sstatic.net/tGbwx.png

https://i.sstatic.net/ymHjb.png

Result in Firefox

Answer №1

To improve loading speeds, consider utilizing the Empty Cache and Hard Reload feature available in Google Chrome's developer mode. This can be accessed by right-clicking on the refresh button!

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

determine the height of a div using jquery calculations

If a div is positioned relative and contains child divs that are positioned absolute, the parent div will have no set height. However, if the contents of the div change dynamically, there should be a way to calculate and adjust the height of the parent acc ...

What Causes the Response to Vary in a Post Request?

Issue: When I use console.log(res.data), it shows different data compared to console.log(JSON.parse(res.request.response)). My Next.js application is sending a post request to an internal API. The response from the REST endpoint should contain a list obje ...

The Firebase JQuery .on method is incrementally updating individual values in an array instead of updating them all simultaneously

I am trying to update the values of the orders placed by users on the Corporate's page without a refresh. I have implemented the jQuery .on method for this purpose. However, the values are being returned one by one from the array created for the order ...

Working with Javascript: Navigating a dynamic array of elements

I need to reorganize a form on my webpage. Currently, all the fields are in one table and I want to move them around based on certain conditions. However, when I try to loop through the elements and move them, the javascript array is changing and causing m ...

Error: Property 'html' is undefined - AJAX response must be displayed only in a specific div

I encountered an issue: Uncaught TypeError: Cannot read property 'html' of undefined I am working on implementing a voting system for each video on my webpage from a database. I have successfully integrated it using AJAX, but the problem is ...

A different task executes prior to completing the jQuery ajax request, ignoring the app's designated sequence

My goal is to retrieve a response from an API in the first function and store it in an object field, then log it in the second function. The app initiates when we invoke the initApp() method, following the same sequence: fetching data first, then logging ...

Custom Alert - Disabling Confirm Button for Ajax Requests

Is there a way to utilize sweetalert for an Ajax call without having a confirm button, but still display a loading gif? In essence, I am looking to have a loading gif shown while the Ajax call is in progress. The current solution available requires enablin ...

Ensuring Map Safety in Typescript

Imagine having a Map structure like the one found in file CategoryMap.ts export default new Map<number, SubCategory[]>([ [11, [100, 101]], [12, [102, 103]], ... ]) Is there a way to create a type guard for this Map? import categoryMap fro ...

Initiate data extraction immediately upon the DOM being fully loaded using NightmareJS

Currently, I am utilizing nightmarejs and facing a challenge that I am struggling to resolve. After using the goto(URL) command, I then proceed to use the evaluate() command to execute specific operations on the webpage. However, I have noticed that while ...

Animating toggles with JQuery

I am attempting to create a toggle effect for my div using this jQuery script: $(document).ready(function(){ $("button").click(function(){ $("div").animate({left:'250px'}; }, function() { $("div").animate({left:'0px'}; }, }); ...

Utilizing Lambda to Analyze PDF Documents with AWS Textract

Struggling with implementing Textract in Lambda to analyze PDF documents using JavaScript. Any assistance would be greatly appreciated. Below is the code snippet: const AWS = require("aws-sdk"); AWS.config.update({ region: proces ...

Utilizing jQuery AJAX to send dual requests

My jQuery AJAX request is experiencing an issue where it seems to be sending two requests. This is causing a problem with my two-factor authentication method, as the second request is failing and affecting the original request. The first request is a post ...

Is there a way to fetch and display property changes in Vue Material's md-dialog?

In the component hierarchy, there is a parent component containing a child, which further contains an md-dialog component. The dialog is opened from the parent component using the following code: ParentComponent.vue <template> <div> < ...

Guidance on implementing fallback font formats using FontFace API

I am exploring the FontFace API (not @fontface) and wondering if there is an easy way to include multiple font formats, similar to providing multiple sources in @fontface. Alternatively, is there a simple method to identify which font formats are supporte ...

Troubleshooting: My Angular 2 Application is Unable to Perform HTTP

I've exhausted all options and I'm still unable to send an http request to my node server on heroku. I can access the route manually, so it's not an issue with the server. Below are snippets of my service and page: **Class is subscription.s ...

What is the best way to create a search function that can filter objects based on both their years and months of investment?

I recently created a website and I'm struggling with searching through multidimensional arrays or objects (I'm not sure what the difference is). Prior to adding the year and month, I was able to access them directly by using array[id][field]. C ...

transferring information between pages in nextjs

Currently in the process of developing a website, specifically working on a registration page for user sign-ups. My main challenge at the moment is validating email addresses without using Links. I need to redirect users to a new page where they can see if ...

Is Node.js or Express.js a server-side language like PHP or something completely different?

Hello, I have a question about Node.js and Express.js. I come from a PHP background and understand that PHP operations and functions execute on the server and return results to the client's screen. In simple terms, does Node.js/Express.js serve the s ...

Exploring the Differences: innerHTML versus appendChild for Loading Scripts

Struggling to dynamically load scripts onto the DOM? function addScript(fileName) { document.body.innerHTML += `<script src='components/${fileName}/${fileName}.js'></script>` } addScript('message-interface') I prefer th ...

How come it is not possible for me to choose all elements containing an attribute value saved in a variable?

Imagine you have the following snippet of HTML code: <div data-id=5>...</div> <img data-id=5 src=...> <input data-id=5 ...> ... Your task is to select and remove all elements with the attribute data-id set to 5. Here is one attemp ...