Ionic 2, Using Angular 2 Pipe breaks on iOS—“Can't find variable: Intl”

后端 未结 4 629
时光说笑
时光说笑 2020-12-05 09:50

Experiencing the same problem with the date, percent, and currency pipes when using them in a template—

For example, I\'m using a simple percent pipe:



        
4条回答
  •  天命终不由人
    2020-12-05 10:38

    That's because it relies on the internalization API, which is not currently available in all browsers (for example not on iOS browser).

    See the compatibility table.

    This is a known issue (beta.1).

    You can try to use a polyfill for Intl.

    To do so, you can use the CDN version, and add this to your index.html:

    
    

    Or if you use Webpack, you can install the Intl module with NPM:

    npm install --save intl
    

    And add these imports to your app:

    import 'intl';
    import 'intl/locale-data/jsonp/en';
    

提交回复
热议问题