Get component child as string
<p>For an I18n-like component, I want to get a component content as string to have a fallback value in case my I18n service gets nothing, this value is supposed to be a fallback one.</p>

<p>I18n service <code>get</code> method:</p>

<pre class="lang-ts prettyprint-override"><code>public get(key:string,
               defaultValue?:string,
               variables:Variables = {},
               domain?:string):string {

        for (let catalogue of this.catalogues) {
            if (catalogue.getDomains().indexOf(domain) &gt;= 0
                &amp;&amp; catalogue.getLocale() == this.locale
                &amp;&amp; catalogue.hasKey(key)) {
                return I18n.setVariables(catalogue.get(key, domain, defaultValue).value, variables);
            }
        }
        return defaultValue;
    }
</code></pre>

<p>I18nComponent:</p>

<pre class="lang-ts prettyprint-override"><code>@Component({
    selector: "i18n",
    template: "{{text}}",
})
export class I18nComponent implements OnInit {

    constructor(private i18n:I18n) {
    }

    @ContentChild() content:string; //Here, I want to store actual value as fallback one.

    @Input('key') key:string;

    @Input('domain') domain:string;

    @Input('variables')
    variables:Variables = [];

    @Input("plural")
    plural:number;

    text:string;

    ngOnInit():any {
        console.log(this.content); //Here I get 'undefined'
        if (this.plural !== undefined &amp;&amp; this.plural != null) {
            this.text = this.i18n.get(this.key, this.content, this.variables, this.domain);
        } else {
            this.text = this.i18n.getPlural(this.key, this.plural, this.content, this.variables, this.domain);
        }
    }
}
</code></pre>

<p>usage example:</p>

<pre class="lang-ts prettyprint-override"><code>&lt;i18n key="FOO_KEY" domain="stackoverflow"&gt;I'm the default value !&lt;/i18n&gt;
</code></pre>

<p>I know <code>&lt;ng-content&gt;&lt;/ng-content&gt;</code> works but only on the template logic, I need a way to get child as string in typescript.</p>

<p>Already tried <code>@ContentChild(String)</code> but I got <code>undefined</code>.</p>

<p>Another way would be to do it like "Loading..." string you can have in the base <code>app</code> component in the index, acting like a placeholder until you get everything loaded. I could do the same for I18n, let the laceholder here until I get something from service to replace it, but I don't know how to achieve this.</p>