Observable returning value after method call finished : <p>getModel() method always return array with empty name array even when languages Observable returns value. why?</p>

<pre><code>    export interface Category extends BaseModel {
      code: string;
      name: LocalizedValue[];
      description: LocalizedValue[];
      active: boolean;
    }

    getAllLanguages(): Observable&lt;Language[]&gt; {
       // this return list of languages
    }

    protected getModel(): Category {
    let model: Category = {
      id: '',
      code: '',
      name: [],
      description: [],
      active: false,
    };
    let nameField: LocalizedValue[] = [];
    this.languageService.getAllLanguages().subscribe(list =&gt; {
      list.forEach(l =&gt; {
        let n: LocalizedValue = {
          language: l.code,
          value: '',
        };
        nameField.push(n);
      });
    });
    model.name = nameField;
    return model;
  }
</code></pre>
