-
Notifications
You must be signed in to change notification settings - Fork 270
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
[Angular] Allow for canactivate and resolvers #376
Conversation
@jlast Can you remove changes related to code formatting? Seems that some formatter is installed in your workspace. |
Thanks for the reply, updated the pull request |
@jlast Please, check again, build is failed |
@sc-illiakovalenko Fixed an import, all checks have passed now. |
@jlast But you still have a lot of changes related to code formatting In the last commit you added it. Please, revert it - carefully |
@sc-illiakovalenko I should keep a dedicated no-format-on-save config for this project 😄 Thanks for your patience, pipelines are succeeding and reformatting is all undone. |
@jlast No problem 😄 |
@jlast For example |
@sc-illiakovalenko alright, updated it |
{ | ||
path: 'SecondComponent', | ||
loadChildren: import('./my/my.module').then(mod => mod.MyModule), | ||
resolve: (input: GuardInput) => { return of(true) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlast Can't use this example. Types are invalid. Please, check it and provide valid example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlast I have to use something like:
resolve: {
ContentBlock: {
resolve: (input: GuardInput) => { return of(true) }
}
}
But it's also not working, I expected to see true
value in data.
{ | ||
path: 'FirstComponent', | ||
loadChildren: import('./my/my.module').then(mod => mod.MyModule), | ||
canActivate: (input: GuardInput) => { return of(true) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlast I can't use this example, because types are invalid, can you provide a valid example?
Type '(input: GuardInput) => any' is not assignable to type 'JssCanActivate | Type<JssCanActivate> | (JssCanActivate | Type<JssCanActivate>)[]'.
Type '(input: GuardInput) => any' is missing the following properties from type '(JssCanActivate | Type<JssCanActivate>)[]'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlast I have to use something like:
canActivate: {
canActivate: (input: GuardInput) => { return of(false) }
}
But it's not correctly
export class AppComponentsModule { } | ||
``` | ||
|
||
Components can also have a for loading using canActivate and canResolve. Classes can be provided as well, they should be derived from JssCanActivate and/or JssResolve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlast Remove extra space in: a for
. And I'm not sure, but we don't have canResolve
inside the package.
So probably, replace it canResolve
-> resolve
function _collectResolverInstances( | ||
factory: ComponentFactoryResult | ||
): Array<[string, JssResolve<any>]> { | ||
if (factory.resolve != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlast Cover in unit-tests case when resolve is not provided.
@jlast I want to ask you, switch target branch to: release/15.0.0. And pull it |
I'll update this merge request probably in 1-2 weeks, working on other priorities for our client at the moment. |
With these changes you can add canactive and resolvers to your application, allowing for components to load their data before rendering.
Combine this with the sc-placeholder loaded event for optimal loading experience.
Description
With these changes you can add canactive and resolvers to your application, allowing for components to load their data before rendering.
Combine this with the sc-placeholder loaded event for optimal loading experience.
Motivation
We needed a better loading experience for customers. This change allowed us to add a pretty skeleton loading before the data was loaded.
How Has This Been Tested?
We included this change into the application.
Types of changes
/docs
directory)Checklist: