Angle performance: Components use 500 (sub) members public objects

I am using Angular 4 with Typescript.

I have a static class with many public static/constant string members whose value will never be Change. Many of my components expose this class to access members from templates:

Static class:

export class Foo {
public static foo1: string = "foo 1";
// ...
public static foo1000: string = "foo 1000";
}

Sample component :

export class FooComponent {
public foo: Foo = Foo;
}

Sample usage in component template:< /p>

{{foo.foo123}}

{{foo.foo321}}

< p>The question is:

>Is this a good design for performance/change detection?
>Is there a way to prevent angle checking (during change detection) of specific members (because they will not change)?
>Or in other words: Can I expose public members/objects with many (string) members in a component without negatively affecting performance?

By the way: I deliberately don’t want to elaborate on why and why it’s so simple.

This has been answered here.

Short answer: There is no problem with large objects, because Angular only checks the fields actually used/referenced in the template.

I’m using Angular 4 with Typescript.

I have a static class with many public static/constant string members whose values ​​never change. Many of my components are This class is exposed to access members from the template:

Static class:

export class Foo {
public static foo1: string = "foo 1";
// ...
public static foo1000: string = "foo 1000";
}

Sample component:

export class FooComponent {
public foo: Foo = Foo;
}

Sample usage in component template:

< /p>

{{foo.foo123}}

{{foo.foo321}}

The problem is:

>Is this a good design for performance/change detection?
>Is there a way to prevent angle checking (during change detection) of specific members (because they will not change)?
>Or in other words: Can I expose public members/objects with many (string) members in a component without negatively affecting performance?

By the way: I deliberately don’t want to elaborate on why and why it’s so simple.

This has been answered here.

< /p>

Short answer: There is no problem with large objects, because Angular only checks the fields actually used/referenced in the template.

Leave a Comment

Your email address will not be published.