setEmbeddedView method

void setEmbeddedView(
  1. CompileView view
)

Implementation

void setEmbeddedView(CompileView view) {
  if (appViewContainer == null) {
    throw StateError('Expected appViewContainer to be set.');
  }
  embeddedView = view;
  var createTemplateRefExpr = o
      .importExpr(Identifiers.TemplateRef)
      .instantiate([appViewContainer!, view.viewFactory],
          type: o.importType(Identifiers.TemplateRef));
  var provider = CompileProviderMetadata(
      token: identifierToken(Identifiers.TemplateRef),
      useValue: createTemplateRefExpr);

  final isReferencedOutsideBuild = _publishesTemplateRef ||
      _getQueriesFor(Identifiers.TemplateRefToken).isNotEmpty;
  // Add TemplateRef as first provider as it does not have deps on other
  // providers
  _resolvedProvidersArray.insert(
    0,
    ProviderAst(
      provider.token!,
      false,
      [provider],
      ProviderAstType.Builtin,
      sourceAst!.sourceSpan,
      eager: true,
      isReferencedOutsideBuild: isReferencedOutsideBuild,
    ),
  );
}