GithubHelp home page GithubHelp logo

Add $location service about angular-apimock HOT 7 CLOSED

seriema avatar seriema commented on June 19, 2024
Add $location service

from angular-apimock.

Comments (7)

seriema avatar seriema commented on June 19, 2024

Yes, the reason we didn't use it was because at the time we need to call location (in .config()) it isn't available. If you know how to make it work, please let us know.

from angular-apimock.

seriema avatar seriema commented on June 19, 2024

We've changed things since then I remember now. It might be possible, will try it out! Hopefully it will allow unit-testing of that part. Busy creating demos atm.

from angular-apimock.

ceoaliongroo avatar ceoaliongroo commented on June 19, 2024

@seriema Thanks,

I did a refactor of the code and add the unit test for your review.

Also, i'll create an issue #4 to extend the test and check or prepare the work with external data services.

from angular-apimock.

seriema avatar seriema commented on June 19, 2024

This issue can be the request for a pure $location refactor. If you do just the $location bit with the tests you have it would be awesome. Please sync down the latest code though, just did some big updates.

from angular-apimock.

seriema avatar seriema commented on June 19, 2024

Two things to think about is routing.

  1. Query parameters like apimock=true don't sit in window.location.search but window.location.hash. Need to verify that this works with $location.
  2. When using ngRoute it doesn't do a page refresh when adding ?apimock=true so the parameter isn't picked up. Need to make sure routes update the mock flag. See here for a sample where this breaks.

from angular-apimock.

ceoaliongroo avatar ceoaliongroo commented on June 19, 2024

@seriema about:

  1. I understood the explanation, but still is difficult see the issue or the new feature that you propourse without a code example.

Could you create a fail spec in the test?
Thanks

  1. You could try to add reloadOnSearch=false in the route
    $routeProvider
      .when('/', {
        templateUrl: 'views/movies-table-list.html',
        controller: 'MoviesCtrl',
        reloadOnSearch: false
      })
      .otherwise({
        redirectTo: '/movies/list/'
      });
  });

Could you give access to the demo code?

All the best...

from angular-apimock.

seriema avatar seriema commented on June 19, 2024
  1. We don't need to worry about that anymore. It seems to be working with $location.

  2. Interesting! Two issues with that though. It would require ngRoute (we want to minimize dependencies) and it seems to be set on a per-url-basis (we need something generic).

The demo code is in the gh-pages-dev branch. Thinking about moving them here to a /docs folder or something.

from angular-apimock.

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.