You could "teach" typescript that there is a "standalone" global variable, 
e.g. in your module:


declare const standalone: any;
.. // further in component..
this.property = standalone === 'true' ? true : false;


You could even give it some type instead of any. But then it's not on your 
imported Window, it's on whatever global namespace you're using.

So if you use this code in a webworker or universal, it might fail.

You could also extend the Window type, but that depends on the details, 
where did you import the Window from etc.


On Thursday, January 4, 2018 at 1:04:26 AM UTC+1, Reza Razavipour wrote:
>
> Not finding the solution anywhere else...
>
> I need to define a variable in my index.html file and use it in my 
> angular4/typescript code and I get a compile error.
>
> my compile error is:
>
>     Error:(109, 27) TS2339: Property 'standalone' does not exist on type 
> 'Window'.
>
> the variable definition in HTML is:
>     <script>
>         var standalone = 'true';
>
>         System.import('app').catch(function (err) {
>             console.error(err);
>         });
>     </script>
>
> the typescript code is:
>
>     if(window.standalone !== undefined) {
>         console.log('standalone');
>     }
>
> Anyone sees what I am doing wrong?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to