Giter VIP home page Giter VIP logo

Comments (4)

shahata avatar shahata commented on July 30, 2024

Yeah, shared services need $apply explicitly in order to trigger digest. I do supply an helper for you if the shared service has methods that are actually setters, that's what the second argument to widgetsProvider.addServiceToShare is for. If you are sharing $http, this second argument won't help you much because you need the digest to be triggered after the promise resolves... It is very easy to solve though... But can you describe the reason you need to share $http and not have each widget/micro-app use his own $http?

from angular-widget.

adri avatar adri commented on July 30, 2024

The $http service is intercepted ($httpProvider.interceptors.push('...');) to add an authentication-token header and handle API responses like 401 Unauthorised (display login form) in a generic way.

I found no way to share providers – although that might be a nice feature as well, if thats even possible? I guess in angular-widget there could be a widgetsProvider.addProviderToShare method which shares a provider using something like $provide.provider(name, provider). Do you think this makes sense at all?

Maybe I'll introduce a ui-router state for each widget with a resolve 'function' which supplies data to the controller, then it should work without a $scope.$apply.

from angular-widget.

shahata avatar shahata commented on July 30, 2024

In the manifest generator you can pass an extra config block to the micro
app. Why not add the interceptor with this argument and so you'll have
separate services, each with its own interceptor?
On Oct 23, 2014 8:27 PM, "Adrian Philipp" [email protected] wrote:

The $http service is intercepted ($httpProvider.interceptors.push('...');)
to add an authentication-token header and handle API responses like401
Unauthorised` (display login form) in a generic way. I found no way to
share providers – although that might be a nice feature as well, if thats
even possible.

Maybe I'll introduce a ui-router state for each widget with a resolve
'function' which supplies data to the controller, then it should work
without a $scope.$apply.


Reply to this email directly or view it on GitHub
#4 (comment).

from angular-widget.

adri avatar adri commented on July 30, 2024

Hey Shahar, thank you very much!

from angular-widget.

Related Issues (19)

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.