Coder Social home page Coder Social logo

Comments (6)

JeremyNevill avatar JeremyNevill commented on August 29, 2024

Ah, looks like the lookup function in the underlying Azure service could be a winner, I'll see if patching that in does the job.

from angular-azure-mobile-service.

TerryMooreII avatar TerryMooreII commented on August 29, 2024

Instead of the complex query function for the criteria you can also pass an object that has the criteria that you want returned like so:

    Azureservice.query('tableName', {
        criteria: {
                id:1  //or what ever id you want returned
            }
        })
        .then(function(data){
                   ...
        },
         function(err){
            console.log(err);
        })

Let me know if this helps.

from angular-azure-mobile-service.

JeremyNevill avatar JeremyNevill commented on August 29, 2024

Terry,

Thanks for the reply, that looks a bit more straightforward than my first attempt ;-)

Here's what I added to my fork to include the underlying lookup method...

            /*
             Get single item in Azure

             @param string tableName       REQUIRED The name of the table to query
             @param string id              REQUIRED String id of the item to get
             @return promise               Returns a WindowsAzure promise
             */
            getSingleItem: function (tableName, id) {
                if (isNullOrUndefined(tableName)) {
                    console.error('Azureservice.update: You must specify a table name');
                    return null;
                }

                if (isNullOrUndefined(id)) {
                    console.error('Azureservice.update: You must specify the id');
                    return null;
                }

                return wrapAzurePromiseWithAngularPromise(getTable(tableName).lookup(id));
            }, 

Cheers,

Jeremy

from angular-azure-mobile-service.

TerryMooreII avatar TerryMooreII commented on August 29, 2024

I like the idea of having a connivence method for getting a singe item by id and for some reason I over looked the Azure client lookup method. Go ahead a submit a pull request for those changes. Maybe change the method name to getById since there is already a getAll method.

from angular-azure-mobile-service.

JeremyNevill avatar JeremyNevill commented on August 29, 2024

Cool. Will do...

from angular-azure-mobile-service.

TerryMooreII avatar TerryMooreII commented on August 29, 2024

Added...

from angular-azure-mobile-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.