Comments (4)
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.
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.
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.
Hey Shahar, thank you very much!
from angular-widget.
Related Issues (19)
- Be able to use relative URLS in Widget html HOT 5
- Nested routers does not work HOT 2
- Issue with ngAnimate HOT 1
- angular-widget.js.map not found HOT 1
- Angular 2 HOT 2
- angular.module('app3').run(angular.noop) HOT 1
- missing changelog or history
- How can I get a reference to "widgets" in the host? HOT 1
- Module error
- Builds and Releases on Auto Pilot?
- Can we get angular widget added to the npm registry? HOT 1
- Options object is empty after getting it from widgetConfig HOT 4
- $translate from angular-translate 2.7.0 onward only works within a $timeout inside of ng-widget. HOT 3
- Updating $rootScope does not update hosting app's view HOT 1
- Access widget config in setManifestGenerator function on child app HOT 1
- Sharing events from widget to hosted app is not working HOT 4
- Asynchronous setManifestGenerator Function
- Define widget manifest inside widget / or lazy load dependencies HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-widget.