Click here to Skip to main content
15,921,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a page that loads values at run-time. some of the APIs I use can take a little while to return. I want to display my spinner.gif in place of the value until my value is updated.

I have a number of functions in an angular module that return different image sources depending on a value (spinner, up arrow, down arrow etc...). I would like to use a similar function to show an image or a value. Maybe I can only have two elements with ng-show on each?

here's where I got to with my function before realizing I had no idea how to implement what I was looking for:

JavaScript
angular.module('NumbersModule', [])
    .service("comparisonService", [
        function () {
            this.getImageOrNumber = function(number) {

                if (typeof number === 'undefined' || number == null)
                    return 0;
                if (number === "spinner")
                    return "/Resources/images/spinner.gif";
                    //At this point I realized that I have been using these in an img ng-src :/
            };


Thanks
Andy
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900