cordova 是否支持 ES6 and/or Angular2?
Is cordova supporting ES6 and/or Angular2?
我想使用 phonegap 创建移动应用程序,我想使用适用于 ES6 的 Angular2。我在他们的官方网站上找不到任何相关信息。
我想知道它是否有效?
更新答案 2021
如果您的目标是 Android 4.4 (or lower) you can't use ES6 because it's not supported unless you use Babel to compile your code (see below). From Android 5.0 the webview is independent from the OS,并且它与 OS 分开更新,那么您可以直接使用 ES6。
您还可以在 caniuse 上检查您的目标 OS/browser ES6 支持。
原回答
ECMAScript 6 支持不依赖于 Cordova,是一个 Webview 问题。
如果将执行应用程序的本机 Webview 支持 ES6,您的应用程序将运行良好,否则不支持。
由于ES6规范终于approved on June 17 of this year (2015),移动Webview对ES6的实际支持缺失或不完整
对于 运行 ECMAScript 6 应用程序,今天您可以使用 Babel or Traceur compiler, that "compile" your code from ES6 to ES5. This is also the approach used in Angular 2 quickstart(请参阅“6 部分中的 traceur 导入。声明 HTML ").
那么,为什么不试试 an Angular 2 generator that include traceur or a web app generator with babel?如果您对所涉及的工具不熟悉,建议您开始学习grunt/gulp/bower/yo。
我想使用 phonegap 创建移动应用程序,我想使用适用于 ES6 的 Angular2。我在他们的官方网站上找不到任何相关信息。 我想知道它是否有效?
更新答案 2021
如果您的目标是 Android 4.4 (or lower) you can't use ES6 because it's not supported unless you use Babel to compile your code (see below). From Android 5.0 the webview is independent from the OS,并且它与 OS 分开更新,那么您可以直接使用 ES6。
您还可以在 caniuse 上检查您的目标 OS/browser ES6 支持。
原回答
ECMAScript 6 支持不依赖于 Cordova,是一个 Webview 问题。
如果将执行应用程序的本机 Webview 支持 ES6,您的应用程序将运行良好,否则不支持。
由于ES6规范终于approved on June 17 of this year (2015),移动Webview对ES6的实际支持缺失或不完整
对于 运行 ECMAScript 6 应用程序,今天您可以使用 Babel or Traceur compiler, that "compile" your code from ES6 to ES5. This is also the approach used in Angular 2 quickstart(请参阅“6 部分中的 traceur 导入。声明 HTML ").
那么,为什么不试试 an Angular 2 generator that include traceur or a web app generator with babel?如果您对所涉及的工具不熟悉,建议您开始学习grunt/gulp/bower/yo。