Angular Compiler Options

I am looking for an explanation for some Angular compiler options , which are listed here :

  • useDebug - enable debugging
  • useJit - incomprehensible (used only in one place )
  • defaultEncapsulation - set the default style encapsulation.
  • providers - it’s not entirely clear (is it the same with the ngModule designer?)
  • missingTranslation - strategy what to do if missing translation key
  • enableLegacyTemplate - support tag template(which is already out of date)
+4
source share
1 answer

useJit

whether the encoding mode or the interpreter is used.

Codegen - , . angular , , .

,

, angular . , ( , , , ), . angular ngfactories, codegen. angular , ..

function _declareFn(
    varNames: string[], statements: o.Statement[], ctx: _ExecutionContext,
    visitor: StatementInterpreter): Function {
  return (...args: any[]) => _executeFunctionStatements(varNames, args, statements, ctx, visitor);
}

, . (, , angular updateDirectives, updateRenderer ..) StatementVisitor .

DART https://github.com/angular/angular/commit/2b34c88b69af8b0031fdb7006327bb8260e23dda#diff-ba3d6dc88c6e1cef871391a7843a614eR167 AFAIK.


, "" .

providers - COMPILER_PROVIDERS

,

1) DomElementSchema

2) DirectiveResolver

3) ResourceLoader

4) Parser, TemplateParser,

..

NgModule, ( JitCompiler ) https://github.com/angular/angular/blob/4.3.x/packages/compiler/src/jit/compiler_factory.ts#L115 https://github.com/angular/angular/blob/4.3.x/packages/core/src/application_ref.ts#L326-L329 @NgModule < 11 >

, :

my-app
  level1
    level2
      level3

:

enter image description here

https://plnkr.co/edit/AYExeiYRSQ4H8LiQEgKo?p=preview

my-app
  router-outlet
    level1
      router-outlet
        level2
          router-outlet
            level3

enter image description here

router-outlet .

. :

+7

Source: https://habr.com/ru/post/1682381/


All Articles