Angular performance: component provides a public object with 500+ (sub) members

I am using angular 4 with Typescript.

I have a static class with many public static / constant string members whose values ​​will never change. This class is displayed on many of my components to have access to elements from templates:

Static class:

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

Component example:

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

An example of using a component template:

<div>{{foo.foo123}}</div>
<div>{{foo.foo321}}</div>

The question arises:

  • Is this a good construction regarding performance / change definition?
  • Is there a way to prevent angular from checking (while detecting changes) certain members (since they still don't change)?
  • , : / () , ?

: , , .

+4
1

.

: , angular , / .

0

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


All Articles