【问题标题】:Angular 4 not working on Tizen Smart TVAngular 4 无法在 Tizen 智能电视上运行
【发布时间】:2017-09-08 14:56:05
【问题描述】:

我创建了一个简单的 Angular4 应用程序,并将其打包为 Tizen 网络应用程序。这个应用程序适用于我测试过的所有主要浏览器(Safari、Chrome 和 Firefox),但会呈现一个带有空 () 元素的空页面。

在调试模式下运行 Tizen 应用程序时,控制台上未显示任何 Javascript 错误。在 Angular4 包含的文件运行正常之后,Javascript 警报也很好。

我注意到的另一件事是 Tizen 需要大约 10 分钟来编译 Angular 生成的 javascript 代码(vendor.js 为 240kb)。

【问题讨论】:

  • 对此我很好奇。 Afaik 打包不会编译任何东西(您可以查看 .wgt 中的文件,这是一个存档),但会创建元数据和验证哈希。如果您发现为什么包装需要这么长时间,请发表评论。这很有趣。
  • @KVNSTOBJEKT Tizen Studio IDE 有一些 JS 自动检查器。虽然我通过禁用 JS 处理程序减少了时间,但它仍然需要时间。但是,如果您使用 CLI,它的打包速度非常快。没有代码检查。它使用 CLI 在 1 秒内打包我们的应用程序,否则需要 2 小时。

标签: angular tizen


【解决方案1】:

您需要检查 polyfills 文件。这是我的文件

/**
 * This file includes polyfills needed by Angular and is loaded before the app.
 * You can add your own extra polyfills to this file.
 *
 * This file is divided into 2 sections:
 *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
 *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
 *      file.
 *
 * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
 * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
 * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
 *
 * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
 */

/***************************************************************************************************
 * BROWSER POLYFILLS
 */

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
// import 'core-js/es6/weak-map';
import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js';  // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';

/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';

/**
 * Required to support Web Animations `@angular/platform-browser/animations`.
 * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
 **/
// import 'web-animations-js';  // Run `npm install --save web-animations-js`.

/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import 'zone.js/dist/zone'; // Included with Angular CLI.

/***************************************************************************************************
 * APPLICATION IMPORTS
 */

【讨论】:

    【解决方案2】:

    您必须在 tsconfig.js 文件中将 target 设置为 es5。那么您的 Angular 应用程序至少可以在 Tizen 3.0 及更高版本中运行。

    Tizen Studio 是一个有问题的应用程序。如果您使用的是 Tizen Studio,我建议您改用 Tizen TV 或 Tizen 命令行界面 (CLI) 的 vscodevscode extension。他们运作良好。 Vscode 也支持类型脚本。

    Tizen TV app 使用 Angular 11 实现。

    【讨论】:

    • Tizen TV 应用程序链接显示 404。:(
    • @SyamkumarS 你找到什么了吗?
    猜你喜欢
    • 1970-01-01
    • 2022-08-17
    • 1970-01-01
    • 2018-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多