-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parcel support #46
Comments
You can always use parcels by calling the |
Yes! I would very much be interested in adding support. As you recommend, I'll work on integrating it into my app with |
I think that an element directive would make the most sense, since they work in all versions of AngularJS, whereas AngularJS components only are supported in newer versions. I think that modifying the bootstrap function might make the most sense: single-spa-angularjs/src/single-spa-angularjs.js Lines 51 to 53 in 372a5c7
Here's a rough idea of what the implementation could look like function bootstrap(opts, applicationProps) {
return Promise.resolve().then(() => {
const module = opts.angular.module('single-spa-angularjs', [])
module.directive('singleSpaParcel', {
restrict: 'E',
template: "<div></div>",
controller: ['$scope', '$element', function ($scope, $element) {
const parcel = applicationProps.mountParcel($scope.parcelConfig, getParcelProps())
$scope.$on('$destroy', () => {
parcel.unmount()
})
$scope.$watch('props', () => {
parcel.update(getParcelProps())
})
function getParcelProps() {
return {
domElement: $element[0],
...scope.props
}
}
})]
})
})
} This is a rough implementation and my AngularJS is a bit rusty, so I might be missing something. |
A couple other notes from this:
|
I've implemented this in #55 |
This is released in https://github.com/single-spa/single-spa-angularjs/releases/tag/v4.2.0 |
Hi!
Is there plan for supporting using parcels in the single-spa-angularjs package? I see how it might be done, but it doesn't look like it's implemented in this package yet?
The text was updated successfully, but these errors were encountered: