Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
Angular2 - How to get properties from class with getter and setter?

I am trying to access class properties and i able to do that. but the problem is i am not able to access get and set method from class.

export class PageModel {
    public ParentID: string = null;
    public Type: string = null;
    public Order: number = 0;

    public get ApplicationManager(): ApplicationManager {
        if (ApplicationManager.Current != null && ApplicationManager.Current.Model != null) {
            return ApplicationManager.Current;
        }
        else {
            return null;
        }
    }

    // Many more methods below.
}

Below is logic for fetching properties from class.

protected GetProperties(obj: any): Array<string> {
    let properties: Array<string> = new Array<string>();

    if (obj != null && typeof obj == "object") {
        for (var property in obj) {
            if (obj.hasOwnProperty(
                 properties.push(property);                    
            }
        }
    }

    if (properties != null)
        properties.sort();

    return properties;
}

In above logic i able to get list of properties but i am not getting get and set method.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda