@angular/core 8.1.0-next.3 → 8.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/bundles/core-testing.umd.js +1 -1
  2. package/bundles/core-testing.umd.min.js +1 -1
  3. package/bundles/core-testing.umd.min.js.map +1 -1
  4. package/bundles/core.umd.js +282 -234
  5. package/bundles/core.umd.js.map +1 -1
  6. package/bundles/core.umd.min.js +61 -61
  7. package/bundles/core.umd.min.js.map +1 -1
  8. package/core.d.ts +218 -233
  9. package/core.metadata.json +1 -1
  10. package/esm2015/index.js +2 -2
  11. package/esm2015/public_api.js +2 -2
  12. package/esm2015/src/change_detection/pipe_transform.js +4 -6
  13. package/esm2015/src/core.js +2 -2
  14. package/esm2015/src/core_render3_private_export.js +2 -2
  15. package/esm2015/src/di/index.js +1 -1
  16. package/esm2015/src/di/injectable.js +1 -1
  17. package/esm2015/src/di/interface/provider.js +1 -1
  18. package/esm2015/src/di/metadata.js +1 -1
  19. package/esm2015/src/event_emitter.js +3 -10
  20. package/esm2015/src/linker/component_factory.js +9 -3
  21. package/esm2015/src/linker/component_factory_resolver.js +9 -2
  22. package/esm2015/src/metadata/di.js +1 -1
  23. package/esm2015/src/metadata/directives.js +4 -3
  24. package/esm2015/src/reflection/reflection_capabilities.js +2 -2
  25. package/esm2015/src/render3/component.js +6 -2
  26. package/esm2015/src/render3/component_ref.js +6 -2
  27. package/esm2015/src/render3/i18n.js +15 -10
  28. package/esm2015/src/render3/index.js +2 -2
  29. package/esm2015/src/render3/instructions/all.js +2 -2
  30. package/esm2015/src/render3/instructions/attribute.js +5 -4
  31. package/esm2015/src/render3/instructions/embedded_view.js +5 -2
  32. package/esm2015/src/render3/instructions/property.js +9 -8
  33. package/esm2015/src/render3/instructions/shared.js +18 -5
  34. package/esm2015/src/render3/instructions/text.js +3 -3
  35. package/esm2015/src/render3/interfaces/container.js +6 -2
  36. package/esm2015/src/render3/interfaces/i18n.js +1 -17
  37. package/esm2015/src/render3/interfaces/node.js +2 -2
  38. package/esm2015/src/render3/interfaces/view.js +2 -2
  39. package/esm2015/src/render3/jit/environment.js +1 -2
  40. package/esm2015/src/render3/node_manipulation.js +212 -191
  41. package/esm2015/src/render3/state.js +6 -3
  42. package/esm2015/src/render3/util/view_traversal_utils.js +7 -2
  43. package/esm2015/src/render3/view_engine_compatibility.js +39 -12
  44. package/esm2015/src/util/assert.js +3 -2
  45. package/esm2015/src/util/decorators.js +1 -1
  46. package/esm2015/src/version.js +1 -1
  47. package/esm5/src/change_detection/pipe_transform.js +1 -1
  48. package/esm5/src/core_render3_private_export.js +2 -2
  49. package/esm5/src/di/index.js +1 -1
  50. package/esm5/src/di/injectable.js +1 -1
  51. package/esm5/src/di/interface/provider.js +1 -1
  52. package/esm5/src/di/metadata.js +1 -1
  53. package/esm5/src/event_emitter.js +3 -10
  54. package/esm5/src/linker/component_factory.js +7 -1
  55. package/esm5/src/linker/component_factory_resolver.js +7 -1
  56. package/esm5/src/metadata/di.js +1 -1
  57. package/esm5/src/metadata/directives.js +4 -3
  58. package/esm5/src/reflection/reflection_capabilities.js +2 -2
  59. package/esm5/src/render3/component.js +5 -2
  60. package/esm5/src/render3/component_ref.js +5 -2
  61. package/esm5/src/render3/i18n.js +11 -7
  62. package/esm5/src/render3/index.js +2 -2
  63. package/esm5/src/render3/instructions/attribute.js +5 -4
  64. package/esm5/src/render3/instructions/embedded_view.js +5 -2
  65. package/esm5/src/render3/instructions/property.js +7 -7
  66. package/esm5/src/render3/instructions/shared.js +15 -5
  67. package/esm5/src/render3/instructions/text.js +3 -3
  68. package/esm5/src/render3/interfaces/container.js +3 -2
  69. package/esm5/src/render3/interfaces/i18n.js +1 -1
  70. package/esm5/src/render3/interfaces/node.js +1 -1
  71. package/esm5/src/render3/interfaces/view.js +1 -1
  72. package/esm5/src/render3/jit/environment.js +1 -2
  73. package/esm5/src/render3/node_manipulation.js +179 -187
  74. package/esm5/src/render3/state.js +6 -3
  75. package/esm5/src/render3/util/view_traversal_utils.js +7 -2
  76. package/esm5/src/render3/view_engine_compatibility.js +32 -12
  77. package/esm5/src/util/assert.js +3 -2
  78. package/esm5/src/util/decorators.js +1 -1
  79. package/esm5/src/version.js +1 -1
  80. package/fesm2015/core.js +335 -242
  81. package/fesm2015/core.js.map +1 -1
  82. package/fesm2015/testing.js +1 -1
  83. package/fesm5/core.js +283 -234
  84. package/fesm5/core.js.map +1 -1
  85. package/fesm5/testing.js +1 -1
  86. package/package.json +1 -1
  87. package/src/r3_symbols.d.ts +73 -90
  88. package/testing/testing.d.ts +1 -1
  89. package/testing.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v8.1.0-next.3
2
+ * @license Angular v8.1.2
3
3
  * (c) 2010-2019 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -947,7 +947,7 @@
947
947
  if (typeof paramTypes === 'undefined') {
948
948
  result[i] = [];
949
949
  }
950
- else if (paramTypes[i] != Object) {
950
+ else if (paramTypes[i] && paramTypes[i] != Object) {
951
951
  result[i] = [paramTypes[i]];
952
952
  }
953
953
  else {
@@ -4000,7 +4000,7 @@
4000
4000
  function assertDomNode(node) {
4001
4001
  // If we're in a worker, `Node` will not be defined.
4002
4002
  assertEqual((typeof Node !== 'undefined' && node instanceof Node) ||
4003
- (typeof node === 'object' && node.constructor.name === 'WebWorkerRenderNode'), true, 'The provided value must be an instance of a DOM Node');
4003
+ (typeof node === 'object' && node.constructor.name === 'WebWorkerRenderNode'), true, "The provided value must be an instance of a DOM Node but got " + stringify(node));
4004
4004
  }
4005
4005
  function assertDataInRange(arr, index) {
4006
4006
  var maxLen = arr ? arr.length : 0;
@@ -4029,13 +4029,14 @@
4029
4029
  // PARENT, NEXT, QUERIES and T_HOST are indices 3, 4, 5 and 6.
4030
4030
  // As we already have these constants in LView, we don't need to re-create them.
4031
4031
  var NATIVE = 7;
4032
+ var VIEW_REFS = 8;
4032
4033
  /**
4033
4034
  * Size of LContainer's header. Represents the index after which all views in the
4034
4035
  * container will be inserted. We need to keep a record of current views so we know
4035
4036
  * which views are already in the DOM (and don't need to be re-added) and so we can
4036
4037
  * remove views from the DOM when they are no longer required.
4037
4038
  */
4038
- var CONTAINER_HEADER_OFFSET = 8;
4039
+ var CONTAINER_HEADER_OFFSET = 9;
4039
4040
 
4040
4041
  /**
4041
4042
  * @license
@@ -4888,8 +4889,11 @@
4888
4889
  * the direction of traversal (up or down the view tree) a bit clearer.
4889
4890
  *
4890
4891
  * @param newView New state to become active
4892
+ * @param safeToRunHooks Whether the runtime is in a state where running lifecycle hooks is valid.
4893
+ * This is not always the case (for example, the application may have crashed and `leaveView` is
4894
+ * being executed while unwinding the call stack).
4891
4895
  */
4892
- function leaveView(newView) {
4896
+ function leaveView(newView, safeToRunHooks) {
4893
4897
  var tView = lView[TVIEW];
4894
4898
  if (isCreationMode(lView)) {
4895
4899
  lView[FLAGS] &= ~4 /* CreationMode */;
@@ -4897,7 +4901,7 @@
4897
4901
  else {
4898
4902
  try {
4899
4903
  resetPreOrderHookFlags(lView);
4900
- executeHooks(lView, tView.viewHooks, tView.viewCheckHooks, checkNoChangesMode, 2 /* AfterViewInitHooksToBeRun */, undefined);
4904
+ safeToRunHooks && executeHooks(lView, tView.viewHooks, tView.viewCheckHooks, checkNoChangesMode, 2 /* AfterViewInitHooksToBeRun */, undefined);
4901
4905
  }
4902
4906
  finally {
4903
4907
  // Views are clean and in update mode after being checked, so these bits are cleared
@@ -6774,7 +6778,12 @@
6774
6778
  return lView;
6775
6779
  }
6776
6780
  /**
6777
- * Given a current view, finds the nearest component's host (LElement).
6781
+ * Given an `LView`, find the closest declaration view which is not an embedded view.
6782
+ *
6783
+ * This method searches for the `LView` associated with the component which declared the `LView`.
6784
+ *
6785
+ * This function may return itself if the `LView` passed in is not an embedded `LView`. Otherwise
6786
+ * it walks the declaration parents until it finds a component view (non-embedded-view.)
6778
6787
  *
6779
6788
  * @param lView LView for which we want a host element node
6780
6789
  * @returns The host node
@@ -11456,6 +11465,8 @@
11456
11465
  tickRootContext(getRootContext(viewToRender));
11457
11466
  }
11458
11467
  else {
11468
+ // Will become true if the `try` block executes with no errors.
11469
+ var safeToRunHooks = false;
11459
11470
  try {
11460
11471
  setPreviousOrParentTNode(null, true);
11461
11472
  oldView = enterView(viewToRender, viewToRender[T_HOST]);
@@ -11467,9 +11478,10 @@
11467
11478
  // matching, etc again and again.
11468
11479
  viewToRender[TVIEW].firstTemplatePass = false;
11469
11480
  refreshDescendantViews(viewToRender);
11481
+ safeToRunHooks = true;
11470
11482
  }
11471
11483
  finally {
11472
- leaveView(oldView);
11484
+ leaveView(oldView, safeToRunHooks);
11473
11485
  setPreviousOrParentTNode(_previousOrParentTNode, _isParent);
11474
11486
  }
11475
11487
  }
@@ -11479,6 +11491,8 @@
11479
11491
  var oldView = enterView(hostView, hostView[T_HOST]);
11480
11492
  var normalExecutionPath = !getCheckNoChangesMode();
11481
11493
  var creationModeIsActive = isCreationMode(hostView);
11494
+ // Will become true if the `try` block executes with no errors.
11495
+ var safeToRunHooks = false;
11482
11496
  try {
11483
11497
  if (normalExecutionPath && !creationModeIsActive && rendererFactory.begin) {
11484
11498
  rendererFactory.begin();
@@ -11493,12 +11507,13 @@
11493
11507
  resetPreOrderHookFlags(hostView);
11494
11508
  templateFn && executeTemplate(hostView, templateFn, 2 /* Update */, context);
11495
11509
  refreshDescendantViews(hostView);
11510
+ safeToRunHooks = true;
11496
11511
  }
11497
11512
  finally {
11498
11513
  if (normalExecutionPath && !creationModeIsActive && rendererFactory.end) {
11499
11514
  rendererFactory.end();
11500
11515
  }
11501
- leaveView(oldView);
11516
+ leaveView(oldView, safeToRunHooks);
11502
11517
  }
11503
11518
  }
11504
11519
  function executeTemplate(lView, templateFn, rf, context) {
@@ -12373,7 +12388,8 @@
12373
12388
  null, // next
12374
12389
  null, // queries
12375
12390
  tNode, // t_host
12376
- native);
12391
+ native, // native,
12392
+ null);
12377
12393
  ngDevMode && attachLContainerDebug(lContainer);
12378
12394
  return lContainer;
12379
12395
  }
@@ -12605,6 +12621,8 @@
12605
12621
  var oldView = enterView(hostView, hostView[T_HOST]);
12606
12622
  var templateFn = hostTView.template;
12607
12623
  var creationMode = isCreationMode(hostView);
12624
+ // Will become true if the `try` block executes with no errors.
12625
+ var safeToRunHooks = false;
12608
12626
  try {
12609
12627
  resetPreOrderHookFlags(hostView);
12610
12628
  creationMode && executeViewQueryFn(1 /* Create */, hostTView, component);
@@ -12614,9 +12632,10 @@
12614
12632
  if (!creationMode || hostTView.staticViewQueries) {
12615
12633
  executeViewQueryFn(2 /* Update */, hostTView, component);
12616
12634
  }
12635
+ safeToRunHooks = true;
12617
12636
  }
12618
12637
  finally {
12619
- leaveView(oldView);
12638
+ leaveView(oldView, safeToRunHooks);
12620
12639
  }
12621
12640
  }
12622
12641
  function executeViewQueryFn(flags, tView, component) {
@@ -13066,7 +13085,8 @@
13066
13085
  function ɵɵproperty(propName, value, sanitizer, nativeOnly) {
13067
13086
  var index = getSelectedIndex();
13068
13087
  ngDevMode && assertNotEqual(index, -1, 'selected index cannot be -1');
13069
- var bindReconciledValue = ɵɵbind(value);
13088
+ var lView = getLView();
13089
+ var bindReconciledValue = bind(lView, value);
13070
13090
  if (bindReconciledValue !== NO_CHANGE) {
13071
13091
  elementPropertyInternal(index, propName, bindReconciledValue, sanitizer, nativeOnly);
13072
13092
  }
@@ -13075,12 +13095,10 @@
13075
13095
  /**
13076
13096
  * Creates a single value binding.
13077
13097
  *
13098
+ * @param lView Current view
13078
13099
  * @param value Value to diff
13079
- *
13080
- * @codeGenApi
13081
13100
  */
13082
- function ɵɵbind(value) {
13083
- var lView = getLView();
13101
+ function bind(lView, value) {
13084
13102
  var bindingIndex = lView[BINDING_INDEX]++;
13085
13103
  storeBindingMetadata(lView);
13086
13104
  return bindingUpdated(lView, bindingIndex, value) ? value : NO_CHANGE;
@@ -13110,8 +13128,9 @@
13110
13128
  */
13111
13129
  function ɵɵupdateSyntheticHostBinding(propName, value, sanitizer, nativeOnly) {
13112
13130
  var index = getSelectedIndex();
13131
+ var lView = getLView();
13113
13132
  // TODO(benlesh): remove bind call here.
13114
- var bound = ɵɵbind(value);
13133
+ var bound = bind(lView, value);
13115
13134
  if (bound !== NO_CHANGE) {
13116
13135
  elementPropertyInternal(index, propName, bound, sanitizer, nativeOnly, loadComponentRenderer);
13117
13136
  }
@@ -13134,10 +13153,11 @@
13134
13153
  var index = getSelectedIndex();
13135
13154
  var lView = getLView();
13136
13155
  // TODO(FW-1340): Refactor to remove the use of other instructions here.
13137
- var bound = ɵɵbind(value);
13156
+ var bound = bind(lView, value);
13138
13157
  if (bound !== NO_CHANGE) {
13139
- return elementAttributeInternal(index, name, bound, lView, sanitizer, namespace);
13158
+ elementAttributeInternal(index, name, bound, lView, sanitizer, namespace);
13140
13159
  }
13160
+ return ɵɵattribute;
13141
13161
  }
13142
13162
 
13143
13163
  /**
@@ -13823,193 +13843,52 @@
13823
13843
  var container = getLContainer(tViewNode, view);
13824
13844
  return container ? nativeParentNode(view[RENDERER], container[NATIVE]) : null;
13825
13845
  }
13826
- /**
13827
- * Stack used to keep track of projection nodes in walkTNodeTree.
13828
- *
13829
- * This is deliberately created outside of walkTNodeTree to avoid allocating
13830
- * a new array each time the function is called. Instead the array will be
13831
- * re-used by each invocation. This works because the function is not reentrant.
13832
- */
13833
- var projectionNodeStack = [];
13834
- /**
13835
- * Walks a tree of TNodes, applying a transformation on the element nodes, either only on the first
13836
- * one found, or on all of them.
13837
- *
13838
- * @param viewToWalk the view to walk
13839
- * @param action identifies the action to be performed on the elements
13840
- * @param renderer the current renderer.
13841
- * @param renderParent Optional the render parent node to be set in all LContainers found,
13842
- * required for action modes Insert and Destroy.
13843
- * @param beforeNode Optional the node before which elements should be added, required for action
13844
- * Insert.
13845
- */
13846
- function walkTNodeTree(viewToWalk, action, renderer, renderParent, beforeNode) {
13847
- var e_1, _a;
13848
- var rootTNode = viewToWalk[TVIEW].node;
13849
- var projectionNodeIndex = -1;
13850
- var currentView = viewToWalk;
13851
- var tNode = rootTNode.child;
13852
- while (tNode) {
13853
- var nextTNode = null;
13854
- if (tNode.type === 3 /* Element */ || tNode.type === 4 /* ElementContainer */) {
13855
- executeNodeAction(action, renderer, renderParent, getNativeByTNode(tNode, currentView), tNode, beforeNode);
13856
- var nodeOrContainer = currentView[tNode.index];
13857
- if (isLContainer(nodeOrContainer)) {
13858
- // This element has an LContainer, and its comment needs to be handled
13859
- executeNodeAction(action, renderer, renderParent, nodeOrContainer[NATIVE], tNode, beforeNode);
13860
- var firstView = nodeOrContainer[CONTAINER_HEADER_OFFSET];
13861
- if (firstView) {
13862
- currentView = firstView;
13863
- nextTNode = currentView[TVIEW].node;
13864
- // When the walker enters a container, then the beforeNode has to become the local native
13865
- // comment node.
13866
- beforeNode = nodeOrContainer[NATIVE];
13867
- }
13868
- }
13869
- }
13870
- else if (tNode.type === 0 /* Container */) {
13871
- var lContainer = currentView[tNode.index];
13872
- executeNodeAction(action, renderer, renderParent, lContainer[NATIVE], tNode, beforeNode);
13873
- var firstView = lContainer[CONTAINER_HEADER_OFFSET];
13874
- if (firstView) {
13875
- currentView = firstView;
13876
- nextTNode = currentView[TVIEW].node;
13877
- // When the walker enters a container, then the beforeNode has to become the local native
13878
- // comment node.
13879
- beforeNode = lContainer[NATIVE];
13880
- }
13881
- }
13882
- else if (tNode.type === 1 /* Projection */) {
13883
- var componentView = findComponentView(currentView);
13884
- var componentHost = componentView[T_HOST];
13885
- var head = componentHost.projection[tNode.projection];
13886
- if (Array.isArray(head)) {
13887
- try {
13888
- for (var head_1 = __values(head), head_1_1 = head_1.next(); !head_1_1.done; head_1_1 = head_1.next()) {
13889
- var nativeNode = head_1_1.value;
13890
- executeNodeAction(action, renderer, renderParent, nativeNode, tNode, beforeNode);
13891
- }
13892
- }
13893
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
13894
- finally {
13895
- try {
13896
- if (head_1_1 && !head_1_1.done && (_a = head_1.return)) _a.call(head_1);
13897
- }
13898
- finally { if (e_1) throw e_1.error; }
13899
- }
13900
- }
13901
- else {
13902
- // Must store both the TNode and the view because this projection node could be nested
13903
- // deeply inside embedded views, and we need to get back down to this particular nested
13904
- // view.
13905
- projectionNodeStack[++projectionNodeIndex] = tNode;
13906
- projectionNodeStack[++projectionNodeIndex] = currentView;
13907
- if (head) {
13908
- currentView = componentView[PARENT];
13909
- nextTNode = currentView[TVIEW].data[head.index];
13910
- }
13911
- }
13912
- }
13913
- else {
13914
- // Otherwise, this is a View
13915
- nextTNode = tNode.child;
13916
- }
13917
- if (nextTNode === null) {
13918
- // this last node was projected, we need to get back down to its projection node
13919
- if (tNode.projectionNext === null && (tNode.flags & 2 /* isProjected */)) {
13920
- currentView = projectionNodeStack[projectionNodeIndex--];
13921
- tNode = projectionNodeStack[projectionNodeIndex--];
13922
- }
13923
- if (tNode.flags & 2 /* isProjected */) {
13924
- nextTNode = tNode.projectionNext;
13925
- }
13926
- else if (tNode.type === 4 /* ElementContainer */) {
13927
- nextTNode = tNode.child || tNode.next;
13928
- }
13929
- else {
13930
- nextTNode = tNode.next;
13931
- }
13932
- /**
13933
- * Find the next node in the TNode tree, taking into account the place where a node is
13934
- * projected (in the shadow DOM) rather than where it comes from (in the light DOM).
13935
- *
13936
- * If there is no sibling node, then it goes to the next sibling of the parent node...
13937
- * until it reaches rootNode (at which point null is returned).
13938
- */
13939
- while (!nextTNode) {
13940
- // If parent is null, we're crossing the view boundary, so we should get the host TNode.
13941
- tNode = tNode.parent || currentView[T_HOST];
13942
- if (tNode === null || tNode === rootTNode)
13943
- return;
13944
- // When exiting a container, the beforeNode must be restored to the previous value
13945
- if (tNode.type === 0 /* Container */) {
13946
- currentView = getLViewParent(currentView);
13947
- beforeNode = currentView[tNode.index][NATIVE];
13948
- }
13949
- if (tNode.type === 2 /* View */) {
13950
- /**
13951
- * If current lView doesn't have next pointer, we try to find it by going up parents
13952
- * chain until:
13953
- * - we find an lView with a next pointer
13954
- * - or find a tNode with a parent that has a next pointer
13955
- * - or find a lContainer
13956
- * - or reach root TNode (in which case we exit, since we traversed all nodes)
13957
- */
13958
- while (!currentView[NEXT] && currentView[PARENT] &&
13959
- !(tNode.parent && tNode.parent.next)) {
13960
- if (tNode === rootTNode)
13961
- return;
13962
- currentView = currentView[PARENT];
13963
- if (isLContainer(currentView)) {
13964
- tNode = currentView[T_HOST];
13965
- currentView = currentView[PARENT];
13966
- beforeNode = currentView[tNode.index][NATIVE];
13967
- break;
13968
- }
13969
- tNode = currentView[T_HOST];
13970
- }
13971
- if (currentView[NEXT]) {
13972
- currentView = currentView[NEXT];
13973
- nextTNode = currentView[T_HOST];
13974
- }
13975
- else {
13976
- nextTNode = tNode.type === 4 /* ElementContainer */ && tNode.child || tNode.next;
13977
- }
13978
- }
13979
- else {
13980
- nextTNode = tNode.next;
13981
- }
13982
- }
13983
- }
13984
- tNode = nextTNode;
13985
- }
13986
- }
13987
13846
  /**
13988
13847
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
13989
13848
  * being passed as an argument.
13990
13849
  */
13991
- function executeNodeAction(action, renderer, parent, node, tNode, beforeNode) {
13850
+ function executeActionOnElementOrContainer(action, renderer, parent, lNodeToHandle, beforeNode) {
13851
+ ngDevMode && assertDefined(lNodeToHandle, '\'lNodeToHandle\' is undefined');
13852
+ var lContainer;
13853
+ var isComponent = false;
13854
+ // We are expecting an RNode, but in the case of a component or LContainer the `RNode` is wrapped
13855
+ // in an array which needs to be unwrapped. We need to know if it is a component and if
13856
+ // it has LContainer so that we can process all of those cases appropriately.
13857
+ if (isLContainer(lNodeToHandle)) {
13858
+ lContainer = lNodeToHandle;
13859
+ }
13860
+ else if (isLView(lNodeToHandle)) {
13861
+ isComponent = true;
13862
+ ngDevMode && assertDefined(lNodeToHandle[HOST], 'HOST must be defined for a component LView');
13863
+ lNodeToHandle = lNodeToHandle[HOST];
13864
+ }
13865
+ var rNode = unwrapRNode(lNodeToHandle);
13866
+ ngDevMode && assertDomNode(rNode);
13992
13867
  if (action === 0 /* Insert */) {
13993
- nativeInsertBefore(renderer, parent, node, beforeNode || null);
13868
+ nativeInsertBefore(renderer, parent, rNode, beforeNode || null);
13994
13869
  }
13995
13870
  else if (action === 1 /* Detach */) {
13996
- nativeRemoveNode(renderer, node, isComponent(tNode));
13871
+ nativeRemoveNode(renderer, rNode, isComponent);
13997
13872
  }
13998
13873
  else if (action === 2 /* Destroy */) {
13999
13874
  ngDevMode && ngDevMode.rendererDestroyNode++;
14000
- renderer.destroyNode(node);
13875
+ renderer.destroyNode(rNode);
13876
+ }
13877
+ if (lContainer != null) {
13878
+ executeActionOnContainer(renderer, action, lContainer, parent, beforeNode);
14001
13879
  }
14002
13880
  }
14003
13881
  function createTextNode(value, renderer) {
14004
13882
  return isProceduralRenderer(renderer) ? renderer.createText(renderStringify(value)) :
14005
13883
  renderer.createTextNode(renderStringify(value));
14006
13884
  }
14007
- function addRemoveViewFromContainer(viewToWalk, insertMode, beforeNode) {
14008
- var renderParent = getContainerRenderParent(viewToWalk[TVIEW].node, viewToWalk);
14009
- ngDevMode && assertNodeType(viewToWalk[TVIEW].node, 2 /* View */);
13885
+ function addRemoveViewFromContainer(lView, insertMode, beforeNode) {
13886
+ var renderParent = getContainerRenderParent(lView[TVIEW].node, lView);
13887
+ ngDevMode && assertNodeType(lView[TVIEW].node, 2 /* View */);
14010
13888
  if (renderParent) {
14011
- var renderer = viewToWalk[RENDERER];
14012
- walkTNodeTree(viewToWalk, insertMode ? 0 /* Insert */ : 1 /* Detach */, renderer, renderParent, beforeNode);
13889
+ var renderer = lView[RENDERER];
13890
+ var action = insertMode ? 0 /* Insert */ : 1 /* Detach */;
13891
+ executeActionOnView(renderer, action, lView, renderParent, beforeNode);
14013
13892
  }
14014
13893
  }
14015
13894
  /**
@@ -14018,7 +13897,7 @@
14018
13897
  * @param lView the `LView` to be detached.
14019
13898
  */
14020
13899
  function renderDetachView(lView) {
14021
- walkTNodeTree(lView, 1 /* Detach */, lView[RENDERER], null);
13900
+ executeActionOnView(lView[RENDERER], 1 /* Detach */, lView, null, null);
14022
13901
  }
14023
13902
  /**
14024
13903
  * Traverses down and up the tree of views and containers to remove listeners and
@@ -14148,15 +14027,15 @@
14148
14027
  * A standalone function which destroys an LView,
14149
14028
  * conducting cleanup (e.g. removing listeners, calling onDestroys).
14150
14029
  *
14151
- * @param view The view to be destroyed.
14030
+ * @param lView The view to be destroyed.
14152
14031
  */
14153
- function destroyLView(view) {
14154
- if (!(view[FLAGS] & 256 /* Destroyed */)) {
14155
- var renderer = view[RENDERER];
14032
+ function destroyLView(lView) {
14033
+ if (!(lView[FLAGS] & 256 /* Destroyed */)) {
14034
+ var renderer = lView[RENDERER];
14156
14035
  if (isProceduralRenderer(renderer) && renderer.destroyNode) {
14157
- walkTNodeTree(view, 2 /* Destroy */, renderer, null);
14036
+ executeActionOnView(renderer, 2 /* Destroy */, lView, null, null);
14158
14037
  }
14159
- destroyViewTree(view);
14038
+ destroyViewTree(lView);
14160
14039
  }
14161
14040
  }
14162
14041
  /**
@@ -14219,7 +14098,7 @@
14219
14098
  /** Removes listeners and unsubscribes from output subscriptions */
14220
14099
  function removeListeners(lView) {
14221
14100
  var tCleanup = lView[TVIEW].cleanup;
14222
- if (tCleanup != null) {
14101
+ if (tCleanup !== null) {
14223
14102
  var lCleanup = lView[CLEANUP];
14224
14103
  for (var i = 0; i < tCleanup.length - 1; i += 2) {
14225
14104
  if (typeof tCleanup[i] === 'string') {
@@ -14371,7 +14250,7 @@
14371
14250
  }
14372
14251
  }
14373
14252
  function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode) {
14374
- if (beforeNode) {
14253
+ if (beforeNode !== null) {
14375
14254
  nativeInsertBefore(renderer, parent, child, beforeNode);
14376
14255
  }
14377
14256
  else {
@@ -14428,7 +14307,7 @@
14428
14307
  * @returns Whether or not the child was appended
14429
14308
  */
14430
14309
  function appendChild(childEl, childTNode, currentView) {
14431
- var e_2, _a;
14310
+ var e_1, _a;
14432
14311
  var renderParent = getRenderParent(childTNode, currentView);
14433
14312
  if (renderParent != null) {
14434
14313
  var renderer = currentView[RENDERER];
@@ -14441,12 +14320,12 @@
14441
14320
  nativeAppendOrInsertBefore(renderer, renderParent, nativeNode, anchorNode);
14442
14321
  }
14443
14322
  }
14444
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
14323
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
14445
14324
  finally {
14446
14325
  try {
14447
14326
  if (childEl_1_1 && !childEl_1_1.done && (_a = childEl_1.return)) _a.call(childEl_1);
14448
14327
  }
14449
- finally { if (e_2) throw e_2.error; }
14328
+ finally { if (e_1) throw e_1.error; }
14450
14329
  }
14451
14330
  }
14452
14331
  else {
@@ -14471,6 +14350,7 @@
14471
14350
  var nextViewIndex = CONTAINER_HEADER_OFFSET + viewIndexInContainer + 1;
14472
14351
  if (nextViewIndex < lContainer.length) {
14473
14352
  var lView = lContainer[nextViewIndex];
14353
+ ngDevMode && assertDefined(lView[T_HOST], 'Missing Host TNode');
14474
14354
  var tViewNodeChild = lView[T_HOST].child;
14475
14355
  return tViewNodeChild !== null ? getNativeByTNode(tViewNodeChild, lView) : lContainer[NATIVE];
14476
14356
  }
@@ -14496,7 +14376,7 @@
14496
14376
  /**
14497
14377
  * Appends nodes to a target projection place. Nodes to insert were previously re-distribution and
14498
14378
  * stored on a component host level.
14499
- * @param lView A LView where nodes are inserted (target VLview)
14379
+ * @param lView A LView where nodes are inserted (target LView)
14500
14380
  * @param tProjectionNode A projection node where previously re-distribution should be appended
14501
14381
  * (target insertion place)
14502
14382
  * @param selectorIndex A bucket from where nodes to project should be taken
@@ -14582,6 +14462,137 @@
14582
14462
  }
14583
14463
  }
14584
14464
  }
14465
+ /**
14466
+ * `executeActionOnView` performs an operation on the view as specified in `action` (insert, detach,
14467
+ * destroy)
14468
+ *
14469
+ * Inserting a view without projection or containers at top level is simple. Just iterate over the
14470
+ * root nodes of the View, and for each node perform the `action`.
14471
+ *
14472
+ * Things get more complicated with containers and projections. That is because coming across:
14473
+ * - Container: implies that we have to insert/remove/destroy the views of that container as well
14474
+ * which in turn can have their own Containers at the View roots.
14475
+ * - Projection: implies that we have to insert/remove/destroy the nodes of the projection. The
14476
+ * complication is that the nodes we are projecting can themselves have Containers
14477
+ * or other Projections.
14478
+ *
14479
+ * As you can see this is a very recursive problem. While the recursive implementation is not the
14480
+ * most efficient one, trying to unroll the nodes non-recursively results in very complex code that
14481
+ * is very hard (to maintain). We are sacrificing a bit of performance for readability using a
14482
+ * recursive implementation.
14483
+ *
14484
+ * @param renderer Renderer to use
14485
+ * @param action action to perform (insert, detach, destroy)
14486
+ * @param lView The LView which needs to be inserted, detached, destroyed.
14487
+ * @param renderParent parent DOM element for insertion/removal.
14488
+ * @param beforeNode Before which node the insertions should happen.
14489
+ */
14490
+ function executeActionOnView(renderer, action, lView, renderParent, beforeNode) {
14491
+ var tView = lView[TVIEW];
14492
+ ngDevMode && assertNodeType(tView.node, 2 /* View */);
14493
+ var viewRootTNode = tView.node.child;
14494
+ while (viewRootTNode !== null) {
14495
+ executeActionOnNode(renderer, action, lView, viewRootTNode, renderParent, beforeNode);
14496
+ viewRootTNode = viewRootTNode.next;
14497
+ }
14498
+ }
14499
+ /**
14500
+ * `executeActionOnProjection` performs an operation on the projection specified by `action`
14501
+ * (insert, detach, destroy).
14502
+ *
14503
+ * Inserting a projection requires us to locate the projected nodes from the parent component. The
14504
+ * complication is that those nodes themselves could be re-projected from their parent component.
14505
+ *
14506
+ * @param renderer Renderer to use
14507
+ * @param action action to perform (insert, detach, destroy)
14508
+ * @param lView The LView which needs to be inserted, detached, destroyed.
14509
+ * @param renderParent parent DOM element for insertion/removal.
14510
+ * @param beforeNode Before which node the insertions should happen.
14511
+ */
14512
+ function executeActionOnProjection(renderer, action, lView, tProjectionNode, renderParent, beforeNode) {
14513
+ var componentLView = findComponentView(lView);
14514
+ var componentNode = componentLView[T_HOST];
14515
+ var nodeToProject = componentNode.projection[tProjectionNode.projection];
14516
+ if (Array.isArray(nodeToProject)) {
14517
+ for (var i = 0; i < nodeToProject.length; i++) {
14518
+ var rNode = nodeToProject[i];
14519
+ ngDevMode && assertDomNode(rNode);
14520
+ executeActionOnElementOrContainer(action, renderer, renderParent, rNode, beforeNode);
14521
+ }
14522
+ }
14523
+ else {
14524
+ var projectionTNode = nodeToProject;
14525
+ var projectedComponentLView = componentLView[PARENT];
14526
+ while (projectionTNode !== null) {
14527
+ executeActionOnNode(renderer, action, projectedComponentLView, projectionTNode, renderParent, beforeNode);
14528
+ projectionTNode = projectionTNode.projectionNext;
14529
+ }
14530
+ }
14531
+ }
14532
+ /**
14533
+ * `executeActionOnContainer` performs an operation on the container and its views as specified by
14534
+ * `action` (insert, detach, destroy)
14535
+ *
14536
+ * Inserting a Container is complicated by the fact that the container may have Views which
14537
+ * themselves have containers or projections.
14538
+ *
14539
+ * @param renderer Renderer to use
14540
+ * @param action action to perform (insert, detach, destroy)
14541
+ * @param lContainer The LContainer which needs to be inserted, detached, destroyed.
14542
+ * @param renderParent parent DOM element for insertion/removal.
14543
+ * @param beforeNode Before which node the insertions should happen.
14544
+ */
14545
+ function executeActionOnContainer(renderer, action, lContainer, renderParent, beforeNode) {
14546
+ ngDevMode && assertLContainer(lContainer);
14547
+ var anchor = lContainer[NATIVE]; // LContainer has its own before node.
14548
+ var native = unwrapRNode(lContainer);
14549
+ // An LContainer can be created dynamically on any node by injecting ViewContainerRef.
14550
+ // Asking for a ViewContainerRef on an element will result in a creation of a separate anchor node
14551
+ // (comment in the DOM) that will be different from the LContainer's host node. In this particular
14552
+ // case we need to execute action on 2 nodes:
14553
+ // - container's host node (this is done in the executeNodeAction)
14554
+ // - container's host node (this is done here)
14555
+ if (anchor !== native) {
14556
+ executeActionOnElementOrContainer(action, renderer, renderParent, anchor, beforeNode);
14557
+ }
14558
+ for (var i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
14559
+ var lView = lContainer[i];
14560
+ executeActionOnView(renderer, action, lView, renderParent, anchor);
14561
+ }
14562
+ }
14563
+ /**
14564
+ * `executeActionOnElementContainer` performs an operation on the ng-container node and its child
14565
+ * nodes as specified by the `action` (insert, detach, destroy).
14566
+ *
14567
+ * @param renderer Renderer to use
14568
+ * @param action action to perform (insert, detach, destroy)
14569
+ * @param lView The LView which needs to be inserted, detached, destroyed.
14570
+ * @param tElementContainerNode The TNode associated with the ElementContainer.
14571
+ * @param renderParent parent DOM element for insertion/removal.
14572
+ * @param beforeNode Before which node the insertions should happen.
14573
+ */
14574
+ function executeActionOnElementContainer(renderer, action, lView, tElementContainerNode, renderParent, beforeNode) {
14575
+ var node = lView[tElementContainerNode.index];
14576
+ executeActionOnElementOrContainer(action, renderer, renderParent, node, beforeNode);
14577
+ var childTNode = tElementContainerNode.child;
14578
+ while (childTNode) {
14579
+ executeActionOnNode(renderer, action, lView, childTNode, renderParent, beforeNode);
14580
+ childTNode = childTNode.next;
14581
+ }
14582
+ }
14583
+ function executeActionOnNode(renderer, action, lView, tNode, renderParent, beforeNode) {
14584
+ var elementContainerRootTNodeType = tNode.type;
14585
+ if (elementContainerRootTNodeType === 4 /* ElementContainer */) {
14586
+ executeActionOnElementContainer(renderer, action, lView, tNode, renderParent, beforeNode);
14587
+ }
14588
+ else if (elementContainerRootTNodeType === 1 /* Projection */) {
14589
+ executeActionOnProjection(renderer, action, lView, tNode, renderParent, beforeNode);
14590
+ }
14591
+ else {
14592
+ ngDevMode && assertNodeOfPossibleTypes(tNode, 3 /* Element */, 0 /* Container */);
14593
+ executeActionOnElementOrContainer(action, renderer, renderParent, lView[tNode.index], beforeNode);
14594
+ }
14595
+ }
14585
14596
 
14586
14597
  /**
14587
14598
  * @license
@@ -15805,7 +15816,10 @@
15805
15816
  refreshDescendantViews(lView); // update mode pass
15806
15817
  var lContainer = lView[PARENT];
15807
15818
  ngDevMode && assertLContainerOrUndefined(lContainer);
15808
- leaveView(lContainer[PARENT]);
15819
+ // It's always safe to run hooks here, as `leaveView` is not called during the 'finally' block
15820
+ // of a try-catch-finally statement, so it can never be reached while unwinding the stack due to
15821
+ // an error being thrown.
15822
+ leaveView(lContainer[PARENT], /* safeToRunHooks */ true);
15809
15823
  setPreviousOrParentTNode(viewHost, false);
15810
15824
  }
15811
15825
 
@@ -16675,7 +16689,7 @@
16675
16689
  function ɵɵtextBinding(value) {
16676
16690
  var lView = getLView();
16677
16691
  var index = getSelectedIndex();
16678
- var bound = ɵɵbind(value);
16692
+ var bound = bind(lView, value);
16679
16693
  if (bound !== NO_CHANGE) {
16680
16694
  textBindingInternal(lView, index, renderStringify(bound));
16681
16695
  }
@@ -17420,6 +17434,8 @@
17420
17434
  var rootView = createLView(null, createTView(-1, null, 1, 0, null, null, null, null), rootContext, rootFlags, null, null, rendererFactory, renderer, undefined, opts.injector || null);
17421
17435
  var oldView = enterView(rootView, null);
17422
17436
  var component;
17437
+ // Will become true if the `try` block executes with no errors.
17438
+ var safeToRunHooks = false;
17423
17439
  try {
17424
17440
  if (rendererFactory.begin)
17425
17441
  rendererFactory.begin();
@@ -17430,9 +17446,10 @@
17430
17446
  rootView[FLAGS] &= ~4 /* CreationMode */;
17431
17447
  resetPreOrderHookFlags(rootView);
17432
17448
  refreshDescendantViews(rootView); // update mode pass
17449
+ safeToRunHooks = true;
17433
17450
  }
17434
17451
  finally {
17435
- leaveView(oldView);
17452
+ leaveView(oldView, safeToRunHooks);
17436
17453
  if (rendererFactory.end)
17437
17454
  rendererFactory.end();
17438
17455
  }
@@ -18121,6 +18138,12 @@
18121
18138
  return ComponentRef;
18122
18139
  }());
18123
18140
  /**
18141
+ * Base class for a factory that can create a component dynamically.
18142
+ * Instantiate a factory for a given type of component with `resolveComponentFactory()`.
18143
+ * Use the resulting `ComponentFactory.create()` method to create a component of that type.
18144
+ *
18145
+ * @see [Dynamic Components](guide/dynamic-component-loader)
18146
+ *
18124
18147
  * @publicApi
18125
18148
  */
18126
18149
  var ComponentFactory = /** @class */ (function () {
@@ -18151,6 +18174,12 @@
18151
18174
  return _NullComponentFactoryResolver;
18152
18175
  }());
18153
18176
  /**
18177
+ * A simple registry that maps `Components` to generated `ComponentFactory` classes
18178
+ * that can be used to create instances of components.
18179
+ * Use to obtain the factory for a given component type,
18180
+ * then use the factory's `create()` method to create a component of that type.
18181
+ *
18182
+ * @see [Dynamic Components](guide/dynamic-component-loader)
18154
18183
  * @publicApi
18155
18184
  */
18156
18185
  var ComponentFactoryResolver = /** @class */ (function () {
@@ -18648,7 +18677,6 @@
18648
18677
  _this._lContainer = _lContainer;
18649
18678
  _this._hostTNode = _hostTNode;
18650
18679
  _this._hostView = _hostView;
18651
- _this._viewRefs = [];
18652
18680
  return _this;
18653
18681
  }
18654
18682
  Object.defineProperty(ViewContainerRef_.prototype, "element", {
@@ -18681,7 +18709,9 @@
18681
18709
  this.remove(0);
18682
18710
  }
18683
18711
  };
18684
- ViewContainerRef_.prototype.get = function (index) { return this._viewRefs[index] || null; };
18712
+ ViewContainerRef_.prototype.get = function (index) {
18713
+ return this._lContainer[VIEW_REFS] !== null && this._lContainer[VIEW_REFS][index] || null;
18714
+ };
18685
18715
  Object.defineProperty(ViewContainerRef_.prototype, "length", {
18686
18716
  get: function () {
18687
18717
  // Note that if there are no views, the container
@@ -18693,11 +18723,12 @@
18693
18723
  configurable: true
18694
18724
  });
18695
18725
  ViewContainerRef_.prototype.createEmbeddedView = function (templateRef, context, index) {
18726
+ this.allocateContainerIfNeeded();
18696
18727
  var adjustedIdx = this._adjustIndex(index);
18697
18728
  var viewRef = templateRef
18698
18729
  .createEmbeddedView(context || {}, this._lContainer, adjustedIdx);
18699
18730
  viewRef.attachToViewContainerRef(this);
18700
- this._viewRefs.splice(adjustedIdx, 0, viewRef);
18731
+ this._lContainer[VIEW_REFS].splice(adjustedIdx, 0, viewRef);
18701
18732
  return viewRef;
18702
18733
  };
18703
18734
  ViewContainerRef_.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
@@ -18713,6 +18744,7 @@
18713
18744
  if (viewRef.destroyed) {
18714
18745
  throw new Error('Cannot insert a destroyed View in a ViewContainer!');
18715
18746
  }
18747
+ this.allocateContainerIfNeeded();
18716
18748
  var lView = viewRef._lView;
18717
18749
  var adjustedIdx = this._adjustIndex(index);
18718
18750
  if (viewAttachedToContainer(lView)) {
@@ -18724,7 +18756,7 @@
18724
18756
  var beforeNode = getBeforeNodeForView(adjustedIdx, this._lContainer);
18725
18757
  addRemoveViewFromContainer(lView, true, beforeNode);
18726
18758
  viewRef.attachToViewContainerRef(this);
18727
- this._viewRefs.splice(adjustedIdx, 0, viewRef);
18759
+ this._lContainer[VIEW_REFS].splice(adjustedIdx, 0, viewRef);
18728
18760
  return viewRef;
18729
18761
  };
18730
18762
  ViewContainerRef_.prototype.move = function (viewRef, newIndex) {
@@ -18737,16 +18769,22 @@
18737
18769
  this.insert(viewRef, newIndex);
18738
18770
  return viewRef;
18739
18771
  };
18740
- ViewContainerRef_.prototype.indexOf = function (viewRef) { return this._viewRefs.indexOf(viewRef); };
18772
+ ViewContainerRef_.prototype.indexOf = function (viewRef) {
18773
+ return this._lContainer[VIEW_REFS] !== null ?
18774
+ this._lContainer[VIEW_REFS].indexOf(viewRef) :
18775
+ 0;
18776
+ };
18741
18777
  ViewContainerRef_.prototype.remove = function (index) {
18778
+ this.allocateContainerIfNeeded();
18742
18779
  var adjustedIdx = this._adjustIndex(index, -1);
18743
18780
  removeView(this._lContainer, adjustedIdx);
18744
- this._viewRefs.splice(adjustedIdx, 1);
18781
+ this._lContainer[VIEW_REFS].splice(adjustedIdx, 1);
18745
18782
  };
18746
18783
  ViewContainerRef_.prototype.detach = function (index) {
18784
+ this.allocateContainerIfNeeded();
18747
18785
  var adjustedIdx = this._adjustIndex(index, -1);
18748
18786
  var view = detachView(this._lContainer, adjustedIdx);
18749
- var wasDetached = view && this._viewRefs.splice(adjustedIdx, 1)[0] != null;
18787
+ var wasDetached = view && this._lContainer[VIEW_REFS].splice(adjustedIdx, 1)[0] != null;
18750
18788
  return wasDetached ? new ViewRef(view, view[CONTEXT], -1) : null;
18751
18789
  };
18752
18790
  ViewContainerRef_.prototype._adjustIndex = function (index, shift) {
@@ -18761,6 +18799,11 @@
18761
18799
  }
18762
18800
  return index;
18763
18801
  };
18802
+ ViewContainerRef_.prototype.allocateContainerIfNeeded = function () {
18803
+ if (this._lContainer[VIEW_REFS] === null) {
18804
+ this._lContainer[VIEW_REFS] = [];
18805
+ }
18806
+ };
18764
18807
  return ViewContainerRef_;
18765
18808
  }(ViewContainerRefToken));
18766
18809
  }
@@ -18827,6 +18870,7 @@
18827
18870
  }
18828
18871
  return null;
18829
18872
  }
18873
+ /** Returns a Renderer2 (or throws when application was bootstrapped with Renderer3) */
18830
18874
  function getOrCreateRenderer2(view) {
18831
18875
  var renderer = view[RENDERER];
18832
18876
  if (isProceduralRenderer(renderer)) {
@@ -18836,9 +18880,14 @@
18836
18880
  throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');
18837
18881
  }
18838
18882
  }
18839
- /** Returns a Renderer2 (or throws when application was bootstrapped with Renderer3) */
18883
+ /** Injects a Renderer2 for the current component. */
18840
18884
  function injectRenderer2() {
18841
- return getOrCreateRenderer2(getLView());
18885
+ // We need the Renderer to be based on the component that it's being injected into, however since
18886
+ // DI happens before we've entered its view, `getLView` will return the parent view instead.
18887
+ var lView = getLView();
18888
+ var tNode = getPreviousOrParentTNode();
18889
+ var nodeAtIndex = getComponentViewByIndex(tNode.index, lView);
18890
+ return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);
18842
18891
  }
18843
18892
 
18844
18893
  /**
@@ -19026,7 +19075,7 @@
19026
19075
  /**
19027
19076
  * @publicApi
19028
19077
  */
19029
- var VERSION = new Version('8.1.0-next.3');
19078
+ var VERSION = new Version('8.1.2');
19030
19079
 
19031
19080
  /**
19032
19081
  * @license
@@ -22226,6 +22275,8 @@
22226
22275
  var oldLView = enterView(rootLView, null);
22227
22276
  var component;
22228
22277
  var tElementNode;
22278
+ // Will become true if the `try` block executes with no errors.
22279
+ var safeToRunHooks = false;
22229
22280
  try {
22230
22281
  var componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, renderer);
22231
22282
  tElementNode = getTNode(0, rootLView);
@@ -22242,9 +22293,10 @@
22242
22293
  component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
22243
22294
  addToViewTree(rootLView, componentView);
22244
22295
  refreshDescendantViews(rootLView);
22296
+ safeToRunHooks = true;
22245
22297
  }
22246
22298
  finally {
22247
- leaveView(oldLView);
22299
+ leaveView(oldLView, safeToRunHooks);
22248
22300
  }
22249
22301
  var componentRef = new ComponentRef$1(this.componentType, component, createElementRef(ElementRef, tElementNode, rootLView), rootLView, tElementNode);
22250
22302
  if (isInternalRootView) {
@@ -23357,15 +23409,19 @@
23357
23409
  * update the translated nodes.
23358
23410
  *
23359
23411
  * @param value The binding's value
23412
+ * @returns This function returns itself so that it may be chained
23413
+ * (e.g. `i18nExp(ctx.name)(ctx.title)`)
23360
23414
  *
23361
23415
  * @codeGenApi
23362
23416
  */
23363
23417
  function ɵɵi18nExp(value) {
23364
- var expression = ɵɵbind(value);
23418
+ var lView = getLView();
23419
+ var expression = bind(lView, value);
23365
23420
  if (expression !== NO_CHANGE) {
23366
23421
  changeMask = changeMask | (1 << shiftsCounter);
23367
23422
  }
23368
23423
  shiftsCounter++;
23424
+ return ɵɵi18nExp;
23369
23425
  }
23370
23426
  /**
23371
23427
  * Updates a translation block or an i18n attribute when the bindings have changed.
@@ -23624,13 +23680,13 @@
23624
23680
  * @deprecated this method is temporary & should not be used as it will be removed soon
23625
23681
  */
23626
23682
  function ɵɵi18nLocalize(input, placeholders) {
23627
- if (placeholders === void 0) { placeholders = {}; }
23628
23683
  if (typeof TRANSLATIONS[input] !== 'undefined') { // to account for empty string
23629
23684
  input = TRANSLATIONS[input];
23630
23685
  }
23631
- return Object.keys(placeholders).length ?
23632
- input.replace(LOCALIZE_PH_REGEXP, function (match, key) { return placeholders[key] || ''; }) :
23633
- input;
23686
+ if (placeholders !== undefined && Object.keys(placeholders).length) {
23687
+ return input.replace(LOCALIZE_PH_REGEXP, function (_, key) { return placeholders[key] || ''; });
23688
+ }
23689
+ return input;
23634
23690
  }
23635
23691
  /**
23636
23692
  * The locale id that the application is currently using (for translations and ICU expressions).
@@ -24325,7 +24381,7 @@
24325
24381
  * that create event emitters. When the title is clicked, the emitter
24326
24382
  * emits an open or close event to toggle the current visibility state.
24327
24383
  *
24328
- * ```
24384
+ * ```html
24329
24385
  * @Component({
24330
24386
  * selector: 'zippy',
24331
24387
  * template: `
@@ -24354,17 +24410,10 @@
24354
24410
  * Access the event object with the `$event` argument passed to the output event
24355
24411
  * handler:
24356
24412
  *
24357
- * ```
24413
+ * ```html
24358
24414
  * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
24359
24415
  * ```
24360
24416
  *
24361
- * ### Notes
24362
- *
24363
- * Uses Rx.Observable but provides an adapter to make it work as specified here:
24364
- * https://github.com/jhusain/observable-spec
24365
- *
24366
- * Once a reference implementation of the spec is available, switch to it.
24367
- *
24368
24417
  * @publicApi
24369
24418
  */
24370
24419
  var EventEmitter = /** @class */ (function (_super) {
@@ -25058,7 +25107,6 @@
25058
25107
  'ɵɵNgOnChangesFeature': ɵɵNgOnChangesFeature,
25059
25108
  'ɵɵProvidersFeature': ɵɵProvidersFeature,
25060
25109
  'ɵɵInheritDefinitionFeature': ɵɵInheritDefinitionFeature,
25061
- 'ɵɵbind': ɵɵbind,
25062
25110
  'ɵɵcontainer': ɵɵcontainer,
25063
25111
  'ɵɵnextContext': ɵɵnextContext,
25064
25112
  'ɵɵcontainerRefreshStart': ɵɵcontainerRefreshStart,
@@ -25929,9 +25977,10 @@
25929
25977
  var HostBinding = makePropDecorator('HostBinding', ɵ8);
25930
25978
  var ɵ9 = function (eventName, args) { return ({ eventName: eventName, args: args }); };
25931
25979
  /**
25932
- * Binds a CSS event to a host listener and supplies configuration metadata.
25980
+ * Decorator that binds a DOM event to a host listener and supplies configuration metadata.
25933
25981
  * Angular invokes the supplied handler method when the host element emits the specified event,
25934
25982
  * and updates the bound element with the result.
25983
+ *
25935
25984
  * If the handler method returns false, applies `preventDefault` on the bound element.
25936
25985
  *
25937
25986
  * @usageNotes
@@ -25939,7 +25988,7 @@
25939
25988
  * The following example declares a directive
25940
25989
  * that attaches a click listener to a button and counts clicks.
25941
25990
  *
25942
- * ```
25991
+ * ```ts
25943
25992
  * @Directive({selector: 'button[counting]'})
25944
25993
  * class CountClicks {
25945
25994
  * numberOfClicks = 0;
@@ -31317,7 +31366,6 @@
31317
31366
  exports.ɵɵtextInterpolateV = ɵɵtextInterpolateV;
31318
31367
  exports.ɵɵembeddedViewStart = ɵɵembeddedViewStart;
31319
31368
  exports.ɵɵprojection = ɵɵprojection;
31320
- exports.ɵɵbind = ɵɵbind;
31321
31369
  exports.ɵɵinterpolation1 = ɵɵinterpolation1;
31322
31370
  exports.ɵɵinterpolation2 = ɵɵinterpolation2;
31323
31371
  exports.ɵɵinterpolation3 = ɵɵinterpolation3;