-
Notifications
You must be signed in to change notification settings - Fork 232
Simplified deferred loading for components #406
Comments
Awesome! |
nit: |
Fair enough. We haven't committed to this exact prefix (though that's what we have parsed so far). Open to reasonable suggestions/alternatives. |
What about |
One confusing bit is this isn't a directive, so we want to differentiate the syntax somehow to make this clear. |
|
I'm okay with Some more ideas:
|
@deferred is better than !deferred, but it is not that important thought.
this is a very, very nice feature @Matan, great job
anxious for 4.0
2017-05-24 16:41 GMT-03:00 Jonah Williams <notifications@github.com>:
… I'm okay with !deferred. You could probably pick any number of symbols
which aren't already used by the template syntax though.
Some more ideas:
@deferred, $deferred,
#deferred would be a template reference however, so I don't think that is
a good choice.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#406 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF6Y3m9xNleWHXHSYZTjCTghBewHcMRTks5r9IfsgaJpZM4NlW0y>
.
--
Jonathan Rezende
|
@matanlurey, do we really need to have different syntax? E.g. |
I like @deferred. |
Sure, we could just do
|
The community wins, we are renaming to |
* Add a series of unit tests to cover various cases. * Fix a bug that caused prefixes to emit like deflib0.deflib0. * Fix a bug where change detection never occurred on deferred components. Closes #406. # Only run our own test suite. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=157527765
How do I control when this deferred component is loaded? E.g. I want to start loading a deferred component as soon as my main page is rendered. |
The component is loaded ~immediately after first render. You can always wrap with an <template [ngIf]="loadComponent">
<expensive-comp @deferred></expensive-comp>
</template> |
Looks like:
will always be loaded and ngIf is ignored. If
|
Ignore my question, found it in caveat: "It can't be used in conjunction with a structural directive". Does this mean the deferred component cannot have any input? |
@wangyizhuo Caveat aside, there's a mistake in your first example. Structural directives manipulate the DOM and only work on <expensive-comp *ngIf="loadComponent" @deferred></expensive-comp> This is unrelated to inputs, which are supported for deferred components. |
Surprise! We have an experimental feature currently being validated, and we're ready to commit to landing it formally in
4.0.0
. We've heard a lot of feedback that users wish deferred/lazy-loading was easier, even when not using a router.As of an upcoming release, we've introduced a new "compile-time" directive:
What
!deferred
means is that the component that is annotated will not be loaded eagerly, rather, we will load that component's library using Dart's deferred loading, and it will be loaded and initialized asynchronously after initial load.Example use
Caveats
!deferred
is a built-in directive, it won't go in yourdirectives: [ ... ]
list.*ngIf
) but you can do this:Some of this functionality works already, but we aren't committing it formally with documentation and an exact contract or better error messages until
4.0
The text was updated successfully, but these errors were encountered: